<?php
defined( '_VALID_MOS' ) or die('<script>window.location.href="http://www.kinifurniture.com";</script>');

class auction_functions {
	// Simply stores a reference to the database handler being used by the script in general
	var $dbh = null;
	var $general = null;

function send_code($type,$username,$SITE_URL)
	{
			$qry1="select * from anggota where username='$username'";
			$total_row1=$this->dbh->query($qry1);
			if(@mysql_num_rows($total_row1)>0)
				$Data1=@mysql_fetch_object($total_row1);
			$reg_id=$Data1->user_id;
			$EmailUP=$Data1->email;
			$password=$Data1->password;
			$Site_mail='support@kinifurniture.com';
			$link=$SITE_URL.'/index.php?show=login&active='.md5($reg_id);
			$linklogin=$SITE_URL.'/index.php?show=login';
			
			$subject='Registration at KINI';
			if ($type=='act')
				$isi = "Congratulation, your account has been created. \n \n Please click link below to activate your account: \n $link \n \n Best regards, \n KINI";
			if ($type=='re_act')
				$isi = "This is your activation code. \n \n Please click link below to activate your account: \n $link \n \n Best regards, \n KINI";
			if ($type=='pass')
			{
				$isi = "This is your Password: \n $password \n \n You may login here $linklogin \n \n Best regards, \n KINI";
				$subject='Forgot Password';
			}

					mail($EmailUP, $subject, $isi,
					 "From: $Site_mail\r\n"
					."Reply-To: $Site_mail\r\n"
					."X-Mailer: PHP/" . phpversion());
					return 1;
//		echo '<script>document.location="index.php?show=message&msg=reg01";</script>';
		}

function get_footer()
	{
$footer='<center><table width="100%" border="0" cellpadding="0" cellspacing="0"><tr><td style="background-image:url(assets/ornaments/lijnonder.gif);">&nbsp;</td></tr>
<tr><td><div align="center" class="footer">&copy; 2014 - KINI - Jl. Wates Km.12, Gubug, Argosari, Sedayu, Bantul<br>
              Yogyakarta 55752 Indonesia </div>
</td></tr>
<tr><td align="center"><br/>
<script type="text/javascript"><!--
google_ad_client = "pub-2205937171658811";
/* 234x60, created 11/29/09 */
google_ad_slot = "8995005140";
google_ad_width = 234;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</td></tr>
</table></center>';
return $footer;
	}


function is_login()
	{
		if(!$_SESSION['SESSIONUSERID'])
		{
			echo"<script>alert('You need to login');</script>";
			echo"<script>window.location.href='index.php?show=login';</script>";
		}
	}

function menuheader()
{
	global $show,$menuheader;	

if($show=='')
$show='index';

if($show=='index' || $show=='message' || $show=='resend')
$menuheader='<div id="navigationbsm" style="position:absolute; left:215px; top:108px; width:582px; height:20px; z-index:9; font-size: 14px;">
    <table width="200" border="0" cellpadding="0" cellspacing="0" id="mainnavigation">
      <tr>
        <td><a href="index.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage("rollbsmhome","","assets/navigation/mainnav3_01.gif",1)"><img src="assets/navigation/mainnav4_01.gif" alt="BSMhome" name="rollbsmhome" width="63" height="23" border="0"></a></td>
        <td><a href="index.php?show=aboutkini" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollbsmabout\',\'\',\'assets/navigation/mainnav1_02.gif\',1)"><img src="assets/navigation/mainav2_02.gif" alt="About KINI" name="rollbsmabout" width="92" height="23" border="0"></a></td>
        <td><a href="index.php?show=catalogue" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollcatalog1\',\'\',\'assets/navigation/catalog2.gif\',1)"><img src="assets/navigation/catalog1.gif" alt="cat1" name="rollcatalog1" width="80" height="23" border="0" id="rollcatalog1"></a></td>
        <td><a href="index.php?show=agenda" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollbsmagenda1\',\'\',\'assets/navigation/mainnav1_04.gif\',1)"><img src="assets/navigation/mainav2_04.gif" alt="KINI agenda" name="rollbsmagenda1" width="77" height="23" border="0" id="rollbsmagenda1"></a></td>
        <td><a href="index.php?show=gallery" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollbsmgallery1\',\'\',\'assets/navigation/mainnav1_05.gif\',1)"><img src="assets/navigation/mainav2_05.gif" alt="KINI gallery" name="rollbsmgallery1" width="78" height="23" border="0" id="rollbsmgallery1"></a></td>
        <td><a href="index.php?show=news" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollbsmnews1\',\'\',\'assets/navigation/mainnav1_06.gif\',1)"><img src="assets/navigation/mainav2_06.gif" alt="KINI news" name="rollbsmnews1" width="62" height="23" border="0" id="rollbsmnews1"></a></td>
        <td><a href="index.php?show=contact" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollbsmcontact1\',\'\',\'assets/navigation/mainnav1_07.gif\',1)"><img src="assets/navigation/mainav2_07.gif" alt="KINI contact" name="rollbsmcontact1" width="83" height="23" border="0" id="rollbsmcontact1"></a></td>
        <td><a href="index.php?show=links" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollbsmlinks1\',\'\',\'assets/navigation/mainnav1_08.gif\',1)"><img src="assets/navigation/mainav2_08.gif" alt="KINI links" name="rollbsmlinks1" width="59" height="23" border="0" id="rollbsmlinks1"></a></td>
      </tr>
    </table>
  </div>';
if($show=='aboutterms')
$menuheader='
    <div id="Layer2" style="position:absolute; left:278px; top:131px; width:434px; height:21px; z-index:11">
    <table width="265" border="0" cellpadding="0" cellspacing="0" id="navigation2">
      <tr>
        <td width="92"><a href="index.php?show=aboutkini" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollmission2\',\'\',\'assets/navigation/aboutnavig1_01.gif\',1)"><img src="assets/navigation/navigabout2_01.gif" alt="KINI mission" name="rollmission2" width="92" height="22" border="0"></a></td>
        <td width="54"><a href="index.php?show=aboutstory" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rolloverstory\',\'\',\'assets/navigation/aboutnavig1_02.gif\',1)"><img src="assets/navigation/navigabout2_02.gif" alt="KINI story" name="rolloverstory" width="54" height="22" border="0"></a></td>
        <td width="115"><a href="index.php?show=aboutenvironment" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rolloverenvir\',\'\',\'assets/navigation/aboutnavig1_03.gif\',1)"><img src="assets/navigation/navigabout2_03.gif" alt="KINI environment" name="rolloverenvir" width="115" height="22" border="0"></a></td>
        <td><a href="index.php?show=aboutterms" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rolloverterms2\',\'\',\'assets/navigation/navabout3_04.gif\',1)"><img src="assets/navigation/navigabout1_04.gif" alt="KINI Terms and Conditions" name="rolloverterms2" width="181" height="22" border="0"></a></td>
      </tr>
    </table>
  </div>
  <div id="navigationbsm" style="position:absolute; left:215px; top:108px; width:582px; height:20px; z-index:9; font-size: 14px;">
    <table width="200" border="0" cellpadding="0" cellspacing="0" id="mainnavigation">
      <tr>
        <td><a href="index.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rolloverhome\',\'\',\'assets/navigation/mainnav1_01.gif\',1)"><img src="assets/navigation/mainav2_01.gif" alt="KINI home" name="rolloverhome" width="63" height="23" border="0"></a></td>
        <td><a href="index.php?show=aboutkini" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rolloverabout\',\'\',\'assets/navigation/mainnav3_02.gif\',1)"><img src="assets/navigation/mainnav4_02.gif" alt="about KINI" name="rolloverabout" width="92" height="23" border="0"></a></td>
        <td><a href="index.php?show=catalogue" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollcatalog\',\'\',\'assets/navigation/catalog2.gif\',1)"><img src="assets/navigation/catalog1.gif" name="rollcatalog" width="80" height="23" border="0"></a></td>
        <td><a href="index.php?show=agenda" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollbsmagenda\',\'\',\'assets/navigation/mainnav1_04.gif\',1)"><img src="assets/navigation/mainav2_04.gif" alt="KINI agenda" name="rollbsmagenda" width="77" height="23" border="0"></a></td>
        <td><a href="index.php?show=gallery" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollbsmgallery\',\'\',\'assets/navigation/mainnav1_05.gif\',1)"><img src="assets/navigation/mainav2_05.gif" alt="KINI gallery" name="rollbsmgallery" width="78" height="23" border="0"></a></td>
        <td><a href="index.php?show=news" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollbsmnews\',\'\',\'assets/navigation/mainnav1_06.gif\',1)"><img src="assets/navigation/mainav2_06.gif" alt="KINI news" name="rollbsmnews" width="62" height="23" border="0"></a></td>
        <td><a href="index.php?show=contact" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollbsmcontact\',\'\',\'assets/navigation/mainnav1_07.gif\',1)"><img src="assets/navigation/mainav2_07.gif" alt="KINI contact" name="rollbsmcontact" width="83" height="23" border="0"></a></td>
        <td><a href="index.php?show=links" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollbsmlinks\',\'\',\'assets/navigation/mainnav1_08.gif\',1)"><img src="assets/navigation/mainav2_08.gif" alt="KINI links" name="rollbsmlinks" width="59" height="23" border="0"></a></td>
      </tr>
    </table>
  </div>
';
if($show=='aboutkini')
$menuheader='
  <div id="navigationbsm" style="position:absolute; left:215px; top:108px; width:582px; height:20px; z-index:9; font-size: 14px;">
    <table width="200" border="0" cellpadding="0" cellspacing="0" id="mainnavigation">
      <tr>
        <td><a href="index.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rolloverhome\',\'\',\'assets/navigation/mainnav1_01.gif\',1)"><img src="assets/navigation/mainav2_01.gif" alt="KINI home" name="rolloverhome" width="63" height="23" border="0"></a></td>
        <td><a href="index.php?show=aboutkini" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rolloverabout\',\'\',\'assets/navigation/mainnav3_02.gif\',1)"><img src="assets/navigation/mainnav4_02.gif" alt="about KINI" name="rolloverabout" width="92" height="23" border="0"></a></td>
        <td><a href="index.php?show=catalogue" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollcatalog\',\'\',\'assets/navigation/catalog2.gif\',1)"><img src="assets/navigation/catalog1.gif" alt="cat1" name="rollcatalog" width="80" height="23" border="0"></a></td>
        <td><a href="index.php?show=agenda" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollbsmagenda\',\'\',\'assets/navigation/mainnav1_04.gif\',1)"><img src="assets/navigation/mainav2_04.gif" alt="KINI agenda" name="rollbsmagenda" width="77" height="23" border="0"></a></td>
        <td><a href="index.php?show=gallery" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollbsmgallery\',\'\',\'assets/navigation/mainnav1_05.gif\',1)"><img src="assets/navigation/mainav2_05.gif" alt="KINI gallery" name="rollbsmgallery" width="78" height="23" border="0"></a></td>
        <td><a href="index.php?show=news" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollbsmnews\',\'\',\'assets/navigation/mainnav1_06.gif\',1)"><img src="assets/navigation/mainav2_06.gif" alt="KINI news" name="rollbsmnews" width="62" height="23" border="0"></a></td>
        <td><a href="index.php?show=contact" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollbsmcontact\',\'\',\'assets/navigation/mainnav1_07.gif\',1)"><img src="assets/navigation/mainav2_07.gif" alt="KINI contact" name="rollbsmcontact" width="83" height="23" border="0"></a></td>
        <td><a href="index.php?show=links" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollbsmlinks\',\'\',\'assets/navigation/mainnav1_08.gif\',1)"><img src="assets/navigation/mainav2_08.gif" alt="KINI links" name="rollbsmlinks" width="59" height="23" border="0"></a></td>
      </tr>
    </table>
  </div>
    <div id="Layer2" style="position:absolute; left:278px; top:131px; width:434px; height:21px; z-index:13; font-size: 14px;">
    <table width="265" border="0" cellpadding="0" cellspacing="0" id="navigation2">
      <tr>
        <td width="92"><a href="index.php?show=aboutkini" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollmission\',\'\',\'assets/navigation/navabout3_01.gif\',1)"><img src="assets/navigation/navigabout3_01.gif" alt="KINI mission" name="rollmission" width="92" height="22" border="0"></a></td>
        <td width="54"><a href="index.php?show=aboutstory" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rolloverstory\',\'\',\'assets/navigation/aboutnavig1_02.gif\',1)"><img src="assets/navigation/navigabout2_02.gif" alt="KINI story" name="rolloverstory" width="54" height="22" border="0"></a></td>
        <td width="115"><a href="index.php?show=aboutenvironment" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rolloverenvir\',\'\',\'assets/navigation/aboutnavig1_03.gif\',1)"><img src="assets/navigation/navigabout2_03.gif" alt="KINI environment" name="rolloverenvir" width="115" height="22" border="0"></a></td>
        <td><a href="index.php?show=aboutterms" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollterms\',\'\',\'assets/navigation/aboutnavig1_04.gif\',1)"><img src="assets/navigation/navigabout2_04.gif" alt="KINI Terms &amp; Conditions" name="rollterms" width="181" height="22" border="0"></a></td>
      </tr>
    </table>
  </div>
';
if($show=='aboutstory')
$menuheader='
  <div id="navigationbsm" style="position:absolute; left:215px; top:108px; width:582px; height:20px; z-index:9; font-size: 14px;">
    <table width="200" border="0" cellpadding="0" cellspacing="0" id="mainnavigation">
      <tr>
        <td><a href="index.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rolloverhome\',\'\',\'assets/navigation/mainnav1_01.gif\',1)"><img src="assets/navigation/mainav2_01.gif" alt="KINI home" name="rolloverhome" width="63" height="23" border="0"></a></td>
        <td><a href="index.php?show=aboutkini" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rolloverabout\',\'\',\'assets/navigation/mainnav3_02.gif\',1)"><img src="assets/navigation/mainnav4_02.gif" alt="about KINI" name="rolloverabout" width="92" height="23" border="0"></a></td>
        <td><a href="index.php?show=catalogue" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollcatalog\',\'\',\'assets/navigation/catalog2.gif\',1)"><img src="assets/navigation/catalog1.gif" name="rollcatalog" width="80" height="23" border="0"></a></td>
        <td><a href="index.php?show=agenda" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollbsmagenda\',\'\',\'assets/navigation/mainnav1_04.gif\',1)"><img src="assets/navigation/mainav2_04.gif" alt="KINI agenda" name="rollbsmagenda" width="77" height="23" border="0"></a></td>
        <td><a href="index.php?show=gallery" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollbsmgallery\',\'\',\'assets/navigation/mainnav1_05.gif\',1)"><img src="assets/navigation/mainav2_05.gif" alt="KINI gallery" name="rollbsmgallery" width="78" height="23" border="0"></a></td>
        <td><a href="index.php?show=news" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollbsmnews\',\'\',\'assets/navigation/mainnav1_06.gif\',1)"><img src="assets/navigation/mainav2_06.gif" alt="KINI news" name="rollbsmnews" width="62" height="23" border="0"></a></td>
        <td><a href="index.php?show=contact" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollbsmcontact\',\'\',\'assets/navigation/mainnav1_07.gif\',1)"><img src="assets/navigation/mainav2_07.gif" alt="KINI contact" name="rollbsmcontact" width="83" height="23" border="0"></a></td>
        <td><a href="index.php?show=links" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollbsmlinks\',\'\',\'assets/navigation/mainnav1_08.gif\',1)"><img src="assets/navigation/mainav2_08.gif" alt="KINI links" name="rollbsmlinks" width="59" height="23" border="0"></a></td>
      </tr>
    </table>
  </div>
  <div id="Layer2" style="position:absolute; left:278px; top:131px; width:434px; height:21px; z-index:11">
    <table width="265" border="0" cellpadding="0" cellspacing="0" id="navigation2">
      <tr>
        <td width="92"><a href="index.php?show=aboutkini" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollmission2\',\'\',\'assets/navigation/aboutnavig1_01.gif\',1)"><img src="assets/navigation/navigabout2_01.gif" alt="KINI mission" name="rollmission2" width="92" height="22" border="0"></a></td>
        <td width="54"><a href="index.php?show=aboutstory" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollstory2\',\'\',\'assets/navigation/navabout3_02.gif\',1)"><img src="assets/navigation/navigabout3_02.gif" alt="KINI story" name="rollstory2" width="54" height="22" border="0"></a></td>
        <td width="115"><a href="index.php?show=aboutenvironment" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rolloverenvir\',\'\',\'assets/navigation/aboutnavig1_03.gif\',1)"><img src="assets/navigation/navigabout2_03.gif" alt="KINI environment" name="rolloverenvir" width="115" height="22" border="0"></a></td>
        <td><a href="index.php?show=aboutterms" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollterms\',\'\',\'assets/navigation/aboutnavig1_04.gif\',1)"><img src="assets/navigation/navigabout2_04.gif" alt="KINI Terms & Conditions" name="rollterms" width="181" height="22" border="0"></a></td>
      </tr>
    </table>
  </div>
';
if($show=='aboutenvironment')
$menuheader='
  <div id="navigationbsm" style="position:absolute; left:215px; top:108px; width:582px; height:20px; z-index:9; font-size: 14px;">
    <table width="200" border="0" cellpadding="0" cellspacing="0" id="mainnavigation">
      <tr>
        <td><a href="index.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rolloverhome\',\'\',\'assets/navigation/mainnav1_01.gif\',1)"><img src="assets/navigation/mainav2_01.gif" alt="KINI home" name="rolloverhome" width="63" height="23" border="0"></a></td>
        <td><a href="index.php?show=aboutkini" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rolloverabout\',\'\',\'assets/navigation/mainnav3_02.gif\',1)"><img src="assets/navigation/mainnav4_02.gif" alt="about KINI" name="rolloverabout" width="92" height="23" border="0"></a></td>
        <td><a href="index.php?show=catalogue" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollcatalog\',\'\',\'assets/navigation/catalog2.gif\',1)"><img src="assets/navigation/catalog1.gif" alt="cat1" name="rollcatalog" width="80" height="23" border="0"></a></td>
        <td><a href="index.php?show=agenda" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollbsmagenda\',\'\',\'assets/navigation/mainnav1_04.gif\',1)"><img src="assets/navigation/mainav2_04.gif" alt="KINI agenda" name="rollbsmagenda" width="77" height="23" border="0"></a></td>
        <td><a href="index.php?show=gallery" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollbsmgallery\',\'\',\'assets/navigation/mainnav1_05.gif\',1)"><img src="assets/navigation/mainav2_05.gif" alt="KINI gallery" name="rollbsmgallery" width="78" height="23" border="0"></a></td>
        <td><a href="index.php?show=news" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollbsmnews\',\'\',\'assets/navigation/mainnav1_06.gif\',1)"><img src="assets/navigation/mainav2_06.gif" alt="KINI news" name="rollbsmnews" width="62" height="23" border="0"></a></td>
        <td><a href="index.php?show=contact" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollbsmcontact\',\'\',\'assets/navigation/mainnav1_07.gif\',1)"><img src="assets/navigation/mainav2_07.gif" alt="KINI contact" name="rollbsmcontact" width="83" height="23" border="0"></a></td>
        <td><a href="index.php?show=links" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollbsmlinks\',\'\',\'assets/navigation/mainnav1_08.gif\',1)"><img src="assets/navigation/mainav2_08.gif" alt="KINI links" name="rollbsmlinks" width="59" height="23" border="0"></a></td>
      </tr>
    </table>
  </div>
  <div id="Layer2" style="position:absolute; left:278px; top:131px; width:434px; height:21px; z-index:11">
    <table width="265" border="0" cellpadding="0" cellspacing="0" id="navigation2">
      <tr>
        <td width="92"><a href="index.php?show=aboutkini" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollmission2\',\'\',\'assets/navigation/aboutnavig1_01.gif\',1)"><img src="assets/navigation/navigabout2_01.gif" alt="KINI mission" name="rollmission2" width="92" height="22" border="0"></a></td>
        <td width="54"><a href="index.php?show=aboutstory" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rolloverstory\',\'\',\'assets/navigation/aboutnavig1_02.gif\',1)"><img src="assets/navigation/navigabout2_02.gif" alt="KINI story" name="rolloverstory" width="54" height="22" border="0"></a></td>
        <td width="115"><a href="index.php?show=aboutenvironment" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollenvironment\',\'\',\'assets/navigation/navabout3_03.gif\',1)"><img src="assets/navigation/navigabout3_03.gif" alt="KINI environment" name="rollenvironment" width="115" height="22" border="0"></a></td>
        <td><a href="index.php?show=aboutterms" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollterms\',\'\',\'assets/navigation/aboutnavig1_04.gif\',1)"><img src="assets/navigation/navigabout2_04.gif" alt="KINI Terms &amp; Conditions" name="rollterms" width="181" height="22" border="0"></a></td>
      </tr>
    </table>
  </div>
';
if($show=='catalogue' || $show=='login' || $show=='register' || $show=='updateprofile')
$menuheader='
  <div id="navigationbsm" style="position:absolute; left:215px; top:108px; width:582px; height:20px; z-index:10; font-size: 14px;">
    <table width="200" border="0" cellpadding="0" cellspacing="0" id="mainnavigation">
      <tr>
        <td><a href="index.php" onMouseOut="MM_swapImgRestore()" 
		onMouseOver="MM_swapImage(\'rollhome1\',\'\',\'assets/navigation/mainnav1_01.gif\',0)"><img src="assets/navigation/mainav2_01.gif" alt="KINI Home" name="rollhome1" width="63" height="23" border="0" id="rollhome1"></a></td>
        <td><a href="index.php?show=aboutkini" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollbsmabout1\',\'\',\'assets/navigation/mainnav1_02.gif\',1)"><img src="assets/navigation/mainav2_02.gif" alt="About KINI" name="rollbsmabout1" width="92" height="23" border="0" id="rollbsmabout1"></a></td>
        <td><a href="index.php?show=catalogue" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollcatalog21\',\'\',\'assets/navigation/catalog2a.gif\',1)"><img src="assets/navigation/catalog1a.gif" name="rollcatalog21" width="80" height="23" border="0" id="rollcatalog21"></a></td>
        <td><a href="index.php?show=agenda" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollbsmagenda1\',\'\',\'assets/navigation/mainnav1_04.gif\',1)"><img src="assets/navigation/mainav2_04.gif" alt="KINI agenda" name="rollbsmagenda1" width="77" height="23" border="0" id="rollbsmagenda1"></a></td>
        <td><a href="index.php?show=gallery" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollbsmgallery1\',\'\',\'assets/navigation/mainnav1_05.gif\',1)"><img src="assets/navigation/mainav2_05.gif" alt="KINI gallery" name="rollbsmgallery1" width="78" height="23" border="0" id="rollbsmgallery1"></a></td>
        <td><a href="index.php?show=news" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollbsmnews1\',\'\',\'assets/navigation/mainnav1_06.gif\',1)"><img src="assets/navigation/mainav2_06.gif" alt="KINI news" name="rollbsmnews1" width="62" height="23" border="0" id="rollbsmnews1"></a></td>
        <td><a href="index.php?show=contact" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollbsmcontact1\',\'\',\'assets/navigation/mainnav1_07.gif\',1)"><img src="assets/navigation/mainav2_07.gif" alt="KINI contact" name="rollbsmcontact1" width="83" height="23" border="0" id="rollbsmcontact1"></a></td>
        <td><a href="index.php?show=links" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollbsmlinks1\',\'\',\'assets/navigation/mainnav1_08.gif\',1)"><img src="assets/navigation/mainav2_08.gif" alt="KINI links" name="rollbsmlinks1" width="59" height="23" border="0" id="rollbsmlinks1"></a></td>
      </tr>
    </table>
  </div>
';
if($show=='agenda')
$menuheader='
  <div id="navigationbsm" style="position:absolute; left:215px; top:108px; width:582px; height:20px; z-index:9; font-size: 14px;">
    <table width="200" border="0" cellpadding="0" cellspacing="0" id="mainnavigation">
      <tr>
        <td><a href="index.php" onMouseOut="MM_swapImgRestore()" 
		onMouseOver="MM_swapImage(\'rollhome\',\'\',\'assets/navigation/mainnav1_01.gif\',0)"><img src="assets/navigation/mainav2_01.gif" alt="KINI Home" name="rollhome" width="63" height="23" border="0"></a></td>
        <td><a href="index.php?show=aboutkini" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollbsmabout\',\'\',\'assets/navigation/mainnav1_02.gif\',1)"><img src="assets/navigation/mainav2_02.gif" alt="About KINI" name="rollbsmabout" width="92" height="23" border="0"></a></td>
        <td><a href="index.php?show=catalogue" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollcatalog1\',\'\',\'assets/navigation/catalog2.gif\',1)"><img src="assets/navigation/catalog1.gif" name="rollcatalog1" width="80" height="23" border="0" id="rollcatalog1"></a></td>
        <td><a href="index.php?show=agenda" onMouseOut="MM_swapImgRestore()" 
		onMouseOver="MM_swapImage(\'rollagend\',\'\',\'assets/navigation/mainnav3_04.gif\',1)"><img src="assets/navigation/mainnav4_04.gif" name="rollagend" width="77" height="23" border="0"></a></td>
        <td><a href="index.php?show=gallery" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollbsmgallery1\',\'\',\'assets/navigation/mainnav1_05.gif\',1)"><img src="assets/navigation/mainav2_05.gif" alt="KINI gallery" name="rollbsmgallery1" width="78" height="23" border="0" id="rollbsmgallery1"></a></td>
        <td><a href="index.php?show=news" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollbsmnews1\',\'\',\'assets/navigation/mainnav1_06.gif\',1)"><img src="assets/navigation/mainav2_06.gif" alt="KINI news" name="rollbsmnews1" width="62" height="23" border="0" id="rollbsmnews1"></a></td>
        <td><a href="index.php?show=contact" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollbsmcontact1\',\'\',\'assets/navigation/mainnav1_07.gif\',1)"><img src="assets/navigation/mainav2_07.gif" alt="KINI contact" name="rollbsmcontact1" width="83" height="23" border="0" id="rollbsmcontact1"></a></td>
        <td><a href="index.php?show=links" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollbsmlinks1\',\'\',\'assets/navigation/mainnav1_08.gif\',1)"><img src="assets/navigation/mainav2_08.gif" alt="KINI links" name="rollbsmlinks1" width="59" height="23" border="0" id="rollbsmlinks1"></a></td>
      </tr>
    </table>
  </div>
';
if($show=='collection' || $show=='product' || $show=='detail')
$menuheader='
  <div id="navigationbsm" style="position:absolute; left:215px; top:108px; width:582px; height:20px; z-index:9; font-size: 14px;">
    <table width="200" border="0" cellpadding="0" cellspacing="0" id="mainnavigation">
      <tr>
        <td><a href="index.php" onMouseOut="MM_swapImgRestore()" 
		onMouseOver="MM_swapImage(\'rollhome1\',\'\',\'assets/navigation/mainnav1_01.gif\',0)"><img src="assets/navigation/mainav2_01.gif" alt="KINI Home" name="rollhome1" width="63" height="23" border="0" id="rollhome1"></a></td>
        <td><a href="index.php?show=aboutkini" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollbsmabout1\',\'\',\'assets/navigation/mainnav1_02.gif\',1)"><img src="assets/navigation/mainav2_02.gif" alt="About KINI" name="rollbsmabout1" width="92" height="23" border="0" id="rollbsmabout1"></a></td>
        <td><a href="index.php?show=catalogue" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollcatalog21\',\'\',\'assets/navigation/catalog2a.gif\',1)"><img src="assets/navigation/catalog1a.gif" name="rollcatalog21" width="80" height="23" border="0" id="rollcatalog21"></a></td>
        <td><a href="index.php?show=agenda" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollbsmagenda1\',\'\',\'assets/navigation/mainnav1_04.gif\',1)"><img src="assets/navigation/mainav2_04.gif" alt="KINI agenda" name="rollbsmagenda1" width="77" height="23" border="0" id="rollbsmagenda1"></a></td>
        <td><a href="index.php?show=gallery" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollbsmgallery1\',\'\',\'assets/navigation/mainnav1_05.gif\',1)"><img src="assets/navigation/mainav2_05.gif" alt="KINI gallery" name="rollbsmgallery1" width="78" height="23" border="0" id="rollbsmgallery1"></a></td>
        <td><a href="index.php?show=news" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollbsmnews1\',\'\',\'assets/navigation/mainnav1_06.gif\',1)"><img src="assets/navigation/mainav2_06.gif" alt="KINI news" name="rollbsmnews1" width="62" height="23" border="0" id="rollbsmnews1"></a></td>
        <td><a href="index.php?show=contact" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollbsmcontact1\',\'\',\'assets/navigation/mainnav1_07.gif\',1)"><img src="assets/navigation/mainav2_07.gif" alt="KINI contact" name="rollbsmcontact1" width="83" height="23" border="0" id="rollbsmcontact1"></a></td>
        <td><a href="index.php?show=links" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollbsmlinks1\',\'\',\'assets/navigation/mainnav1_08.gif\',1)"><img src="assets/navigation/mainav2_08.gif" alt="KINI links" name="rollbsmlinks1" width="59" height="23" border="0" id="rollbsmlinks1"></a></td>
      </tr>
    </table>
  </div>
';
if($show=='gallery' || $show=='album' || $show=='albumdetail')
$menuheader='
  <div id="navigationbsm" style="position:absolute; left:215px; top:108px; width:582px; height:20px; z-index:9; font-size: 14px;">
    <table width="200" border="0" cellpadding="0" cellspacing="0" id="mainnavigation">
      <tr>
        <td><a href="index.php" onMouseOut="MM_swapImgRestore()" 
		onMouseOver="MM_swapImage(\'rollhome\',\'\',\'assets/navigation/mainnav1_01.gif\',0)"><img src="assets/navigation/mainav2_01.gif" alt="KINI Home" name="rollhome" width="63" height="23" border="0"></a></td>
        <td><a href="index.php?show=aboutkini" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollbsmabout\',\'\',\'assets/navigation/mainnav1_02.gif\',1)"><img src="assets/navigation/mainav2_02.gif" alt="About KINI" name="rollbsmabout" width="92" height="23" border="0"></a></td>
        <td><a href="index.php?show=catalogue" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollcatalog1\',\'\',\'assets/navigation/catalog2.gif\',1)"><img src="assets/navigation/catalog1.gif" name="rollcatalog1" width="80" height="23" border="0" id="rollcatalog1"></a></td>
        <td><a href="index.php?show=agenda" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollbsmagenda\',\'\',\'assets/navigation/mainnav1_04.gif\',1)"><img src="assets/navigation/mainav2_04.gif" alt="KINI agenda" name="rollbsmagenda" width="77" height="23" border="0"></a></td>
        <td><a href="index.php?show=gallery" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollovergallery\',\'\',\'assets/navigation/mainnav3_05.gif\',1)"><img src="assets/navigation/mainnav4_05.gif" name="rollovergallery" width="78" height="23" border="0"></a></td>
        <td><a href="index.php?show=news" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollbsmnews1\',\'\',\'assets/navigation/mainnav1_06.gif\',1)"><img src="assets/navigation/mainav2_06.gif" alt="KINI news" name="rollbsmnews1" width="62" height="23" border="0" id="rollbsmnews1"></a></td>
        <td><a href="index.php?show=contact" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollbsmcontact1\',\'\',\'assets/navigation/mainnav1_07.gif\',1)"><img src="assets/navigation/mainav2_07.gif" alt="KINI contact" name="rollbsmcontact1" width="83" height="23" border="0" id="rollbsmcontact1"></a></td>
        <td><a href="index.php?show=links" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollbsmlinks1\',\'\',\'assets/navigation/mainnav1_08.gif\',1)"><img src="assets/navigation/mainav2_08.gif" alt="KINI links" name="rollbsmlinks1" width="59" height="23" border="0" id="rollbsmlinks1"></a></td>
      </tr>
    </table>
  </div>
';
if($show=='news')
$menuheader='
  <div id="navigationbsm" style="position:absolute; left:215px; top:108px; width:582px; height:20px; z-index:9">
    <table width="200" border="0" cellpadding="0" cellspacing="0" id="mainnavigation">
      <tr>
        <td><a href="index.php" onMouseOut="MM_swapImgRestore()" 
		onMouseOver="MM_swapImage(\'rollhome\',\'\',\'assets/navigation/mainnav1_01.gif\',0)"><img src="assets/navigation/mainav2_01.gif" alt="KINI Home" name="rollhome" width="63" height="23" border="0"></a></td>
        <td><a href="index.php?show=aboutkini" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollbsmabout\',\'\',\'assets/navigation/mainnav1_02.gif\',1)"><img src="assets/navigation/mainav2_02.gif" alt="About KINI" name="rollbsmabout" width="92" height="23" border="0"></a></td>
        <td><a href="index.php?show=catalogue" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollcatalog\',\'\',\'assets/navigation/catalog2.gif\',1)"><img src="assets/navigation/catalog1.gif" name="rollcatalog" width="80" height="23" border="0"></a></td>
        <td><a href="index.php?show=agenda" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollbsmagenda\',\'\',\'assets/navigation/mainnav1_04.gif\',1)"><img src="assets/navigation/mainav2_04.gif" alt="KINI agenda" name="rollbsmagenda" width="77" height="23" border="0"></a></td>
        <td><a href="index.php?show=gallery" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollbsmgallery\',\'\',\'assets/navigation/mainnav1_05.gif\',1)"><img src="assets/navigation/mainav2_05.gif" alt="KINI gallery" name="rollbsmgallery" width="78" height="23" border="0"></a></td>
        <td><a href="index.php?show=news" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollnews1\',\'\',\'assets/navigation/mainnav3_06.gif\',1)"><img src="assets/navigation/mainnav4_06.gif" alt="KINI news" name="rollnews1" width="62" height="23" border="0"></a></td>
        <td><a href="index.php?show=contact" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollbsmcontact\',\'\',\'assets/navigation/mainnav1_07.gif\',1)"><img src="assets/navigation/mainav2_07.gif" alt="KINI contact" name="rollbsmcontact" width="83" height="23" border="0"></a></td>
        <td><a href="index.php?show=links" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollbsmlinks\',\'\',\'assets/navigation/mainnav1_08.gif\',1)"><img src="assets/navigation/mainav2_08.gif" alt="KINI links" name="rollbsmlinks" width="59" height="23" border="0"></a></td>
      </tr>
    </table>
  </div>
';
if($show=='contact')
$menuheader='
  <div id="navigationbsm" style="position:absolute; left:215px; top:108px; width:582px; height:20px; z-index:10; font-size: 14px;">
    <table width="200" border="0" cellpadding="0" cellspacing="0" id="mainnavigation">
      <tr>
        <td><a href="index.php" onMouseOut="MM_swapImgRestore()" 
		onMouseOver="MM_swapImage(\'rollhome1\',\'\',\'assets/navigation/mainnav1_01.gif\',0)"><img src="assets/navigation/mainav2_01.gif" alt="KINI Home" name="rollhome1" width="63" height="23" border="0" id="rollhome1"></a></td>
        <td><a href="index.php?show=aboutkini" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollbsmabout1\',\'\',\'assets/navigation/mainnav1_02.gif\',1)"><img src="assets/navigation/mainav2_02.gif" alt="About KINI" name="rollbsmabout1" width="92" height="23" border="0" id="rollbsmabout1"></a></td>
        <td><a href="index.php?show=catalogue" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollcatalog1\',\'\',\'assets/navigation/catalog2.gif\',1)"><img src="assets/navigation/catalog1.gif" name="rollcatalog1" width="80" height="23" border="0" id="rollcatalog1"></a></td>
        <td><a href="index.php?show=agenda" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollbsmagenda1\',\'\',\'assets/navigation/mainnav1_04.gif\',1)"><img src="assets/navigation/mainav2_04.gif" alt="KINI agenda" name="rollbsmagenda1" width="77" height="23" border="0" id="rollbsmagenda1"></a></td>
        <td><a href="index.php?show=gallery" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollbsmgallery1\',\'\',\'assets/navigation/mainnav1_05.gif\',1)"><img src="assets/navigation/mainav2_05.gif" alt="KINI gallery" name="rollbsmgallery1" width="78" height="23" border="0" id="rollbsmgallery1"></a></td>
        <td><a href="index.php?show=news" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollbsmnews1\',\'\',\'assets/navigation/mainnav1_06.gif\',1)"><img src="assets/navigation/mainav2_06.gif" alt="KINI news" name="rollbsmnews1" width="62" height="23" border="0" id="rollbsmnews1"></a></td>
        <td><a href="index.php?show=contact" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollcontact1\',\'\',\'assets/navigation/mainnav3_07.gif\',1)"><img src="assets/navigation/mainnav4_07.gif" alt="KINI Contact" name="rollcontact1" width="83" height="23" border="0" id="rollcontact1"></a></td>
        <td><a href="index.php?show=links" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollbsmlinks1\',\'\',\'assets/navigation/mainnav1_08.gif\',1)"><img src="assets/navigation/mainav2_08.gif" alt="KINI links" name="rollbsmlinks1" width="59" height="23" border="0" id="rollbsmlinks1"></a></td>
      </tr>
    </table>
  </div>
';
if($show=='links')
$menuheader='
  <div id="navigationbsm" style="position:absolute; left:215px; top:108px; width:582px; height:20px; z-index:9">
    <table width="200" border="0" cellpadding="0" cellspacing="0" id="mainnavigation">
      <tr>
        <td><a href="index.php" onMouseOut="MM_swapImgRestore()" 
		onMouseOver="MM_swapImage(\'rollhome\',\'\',\'assets/navigation/mainnav1_01.gif\',0)"><img src="assets/navigation/mainav2_01.gif" alt="KINI Home" name="rollhome" width="63" height="23" border="0"></a></td>
        <td><a href="index.php?show=aboutkini" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollbsmabout\',\'\',\'assets/navigation/mainnav1_02.gif\',1)"><img src="assets/navigation/mainav2_02.gif" alt="About KINI" name="rollbsmabout" width="92" height="23" border="0"></a></td>
        <td><a href="index.php?show=catalogue" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollcatalog\',\'\',\'assets/navigation/catalog2.gif\',1)"><img src="assets/navigation/catalog1.gif" name="rollcatalog" width="80" height="23" border="0"></a></td>
        <td><a href="index.php?show=agenda" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollbsmagenda\',\'\',\'assets/navigation/mainnav1_04.gif\',1)"><img src="assets/navigation/mainav2_04.gif" alt="KINI agenda" name="rollbsmagenda" width="77" height="23" border="0"></a></td>
        <td><a href="index.php?show=gallery" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollbsmgallery\',\'\',\'assets/navigation/mainnav1_05.gif\',1)"><img src="assets/navigation/mainav2_05.gif" alt="KINI gallery" name="rollbsmgallery" width="78" height="23" border="0"></a></td>
        <td><a href="index.php?show=news" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollbsmnews1\',\'\',\'assets/navigation/mainnav1_06.gif\',1)"><img src="assets/navigation/mainav2_06.gif" alt="KINI news" name="rollbsmnews1" width="62" height="23" border="0" id="rollbsmnews1"></a></td>
        <td><a href="index.php?show=contact" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rollbsmcontact\',\'\',\'assets/navigation/mainnav1_07.gif\',1)"><img src="assets/navigation/mainav2_07.gif" alt="KINI contact" name="rollbsmcontact" width="83" height="23" border="0"></a></td>
        <td><a href="index.php?show=links" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'rolinks\',\'\',\'assets/navigation/mainnav3_08.gif\',1)"><img src="assets/navigation/mainnav4_08.gif" name="rolinks" width="59" height="23" border="0"></a></td>
      </tr>
    </table>
  </div>
';

if(!$_SESSION['SESSIONUSERID'])
	{
	$menuheader.='
		<div id="logininvit">
			<div align="right" class="login">Welcome <b>Guest</b><br/>Please <a href="index.php?show=login">login</a>  or <a href="index.php?show=register">register</a> to see all collection items</div>
		</div>';
	}
else 
	{
	$qry12="select * from anggota where user_id='".$_SESSION['SESSIONUSERID']."'";
	$total_row12=$this->dbh->query($qry12);

	while($sqlRow12=@mysql_fetch_object($total_row12))
		{
		$member=$sqlRow12->nama;
		}
	$menuheader.='
		<div id="logininvit">
		<div align="right" class="login">Welcome <b>'.$member.'</b><br/><a href="index.php?show=logout">Logout</a>  or <a href="index.php?show=updateprofile">Update</a> your profile</div>
		</div>';
	}
return $menuheader;
}

function auction_functions($dbh='')
{
		$this->dbh = $dbh;
}

function footer()
{
	global $footer;	
		
$footer_main='<div align="center" class="style6"><table width="100%"  border="0" cellpadding="0" cellspacing="0" id="txtadres">
          <tr><td height="40" width="100%" style="background-image: url(assets/ornaments/lijnonder.gif);"></td><tr>
	  <tr>
            <td align="center"><font size=2 color=#4C3E35><b>&copy; 2014 - KINI - Jl. Wates Km.12, Gubug, Argosari, Sedayu, Bantul<br>
              Yogyakarta 55752 Indonesia</b></font></td>
          </tr>
        </table></div>';

	return $footer_main;
}

//////////////////////////  Starting of Header Function   //////////////////////////////

function header($Link_url,$SITE_TITLE,$register_form,$edit_form,$Logo,$SITE_URL)
{
global $show,$Site_open_close_time,$meta_description,$meta_keyword;
	
$header='<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">';
$header.='<html>
<script type="text/javascript">
<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
//-->
</script>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />';

global $id;

$header.='<title>'.$SITE_TITLE.'dddddddddddddddd</title>
<link href="'.$SITE_URL.'/externalcss/centercontainer.css" rel="stylesheet" type="text/css">
<link href="'.$SITE_URL.'/externalcss/maintxt.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="'.$SITE_URL.'/Scripts/AC_RunActiveContent.js"></script>';

$header.='</head>
<body onLoad="MM_preloadImages("assets/navigation/mainnav3_01.gif","assets/navigation/mainnav1_02.gif","assets/navigation/catalog2.gif","assets/navigation/mainnav1_04.gif","assets/navigation/mainnav1_05.gif","assets/navigation/mainnav1_06.gif","assets/navigation/mainnav1_07.gif","assets/navigation/mainnav1_08.gif")">
<div id="container">
  <div class="maintxt" id="logininvit">';
if ($_SESSION['username']=='')
$header.='
    <div align="right" class="menuaccount">Welcome: <font color="#FF3300"> Guest</font><br />
        <a href="register.php">register</a> - <a href="login.php">login</a></strong></div>
    </div>';
  else
$header.='
    <div align="right" class="menuaccount">Welcome: <font color="#FF3300"> '.$_SESSION['username'].'</font><br />
        <a href="updatemember.php">change personal settings</a> - <a href="logout.php">logout</a></strong></div>
    </div>
  </div>';  	 
$header.='  <div id="Layer1" style="position:absolute; left:212px; top:25px; width:201px; height:70px; z-index:7; font-size: 14px;"><img src="assets/logosmall.jpg" alt="logosmall" width="200" height="69"></div>
  <div id="side1left" style="position:absolute; left:150px; top:-30px; width:39px; height:751px; z-index:7; background-color: #ececd2; layer-background-color: #ececd2; border: 1px none #000000;"></div>
  <div id="side1right" style="position:absolute; left:834px; top:0px; width:39px; height:721px; z-index:11; background-color: #ececd2; layer-background-color: #ececd2; border: 1px none #000000; font-size: 14px;"></div>
  <div id="furniture1" style="position:absolute; left:59px; top:9px; width:155px; height:328px; z-index:16"><img src="assets/ornaments/ornament1a.gif" alt="orn1" width="133" height="295"></div>
  <div id="Middle" style="position:absolute; left:189px; top:0px; width:659px; height:720px; z-index:6; background-color: #FFFFFF; layer-background-color: #FFFFFF; border: 1px none #000000;"></div>
  <div id="furniture2" style="position:absolute; left:76px; top:331px; width:120px; height:343px; z-index:17"><img src="assets/ornaments/ornament2a.gif" width="117" height="249"></div>
';
$pieces=explode('/',$_SERVER['PHP_SELF']);

	return $header;
}



function suggestion_auction($pro_id,$category_id,$title)
{
global $lang,$Small_box,$Timer_countdown,$watermark_small;

$block_auction=$this->Get_unpaid_win_auction_title();
$qry="select b.* from bid as b left join bid_details as d on b.id=d.item_id where b.deleted='N' and b.id!='$pro_id' and b.status='Y' and b.start='Y' and b.end_bid!='Y' and b.auction_type!='P' and b.running='Y' and d.lang='".$_SESSION['LANG']."'";

if($block_auction!='' && $_SESSION['SESSIONUSERID']!='')
	$qry.=" and d.title not in ($block_auction)";
	if($category_id!='')
		$qry.=" and b.category='$category_id'";
	/*if($title!='')
		$qry.=" and title like '%$title%'";*/

$qry.=" order by b.sequenceid,b.end_bid,b.extends_time,b.id desc limit 0,4";


$total_row=$this->dbh->query($qry);
$TOTAL_RECORDSET=mysql_num_rows($total_row);

$i=0;
if($TOTAL_RECORDSET>0)
{
$suggestion_auction='<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td class="heading">'.$lang['bid_now'].' - <span><font color="#FFFFFF">'.$lang['about_to_end'].'</font></span></td>
  </tr>
  <tr><td>
  <table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td>&nbsp;</td>'; 
while($sqlRow=@mysql_fetch_object($total_row))
	{
	$bid_rate=$sqlRow->bid_rate;
	$Max_bid=$sqlRow->final_bid; 	
	$Get_bid_time=$this->Get_bid_time($sqlRow->id);
	
	$saving_price=$sqlRow->normal_rate-$Max_bid;
	list($hh, $mm, $ss) = explode(":", $Get_bid_time);

	$image_path="bid_images/watermark_".$sqlRow->image_path; 
		if($sqlRow->image_path!='' && file_exists($image_path))
		 $update_pic=$this->Get_newimage($image_path,65,65);
	else
	$update_pic=$this->Get_newimage("images/mainsite/400x310_img_nfound.jpg",65,65);	
		$imge=' <div style="background:url('.$update_pic.') center no-repeat; height:65px; width:65px;">
		  <div> <img src="'.$watermark_small.'" border="0" style="padding-left:3px;" align="left" height="45" width="45" /></div>
			</div>';
	$Get_mobile_number=$sqlRow->last_mobile;
	
	$final_mobile_number=$this->Get_idmaxbid($Get_mobile_number,$sqlRow->id);
	
		if($final_mobile_number=='')
			$high_bidder=$lang['no_bidder'];
		else
			$high_bidder=$final_mobile_number;
	
	$title=$this->get_auction_details($sqlRow->id);	

	$suggestion_auction.='<td width="223" align="left"><table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr><td height="8"></td></tr>
  <tr>
    <td align="left"><img src="images/mainsite/live_pro_top.jpg" /></td>
  </tr>
    <tr>
    <td class="live_product_bg">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td class="sm_text_name">'.ucfirst($title).'</td>
  </tr>
  <tr><td height="5"></td></tr>
  <tr><td><table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="35%" align="center" ><a href="index.php?show=product&id='.$sqlRow->id.'" style="cursor:pointer;"> '.$imge.'</a></td>
     <td width="35%" ><table width="100%" border="0" cellspacing="0" cellpadding="0">';
  
  if($sqlRow->running=='Y')
  $suggestion_auction.='<tr><td class="sm_text_time"><div id="counter_index_div_'.$sqlRow->id.'">00:00:00</div></td></tr>';
  else
  $suggestion_auction.='<tr><td class="sm_text_time"><div id="counter_index_div_'.$sqlRow->id.'">Pause</div></td></tr>';

   $suggestion_auction.='<tr><td class="sm_text_fixed"><div id="price_index_div_'.$sqlRow->id.'">'.$this->Get_Price_format($Max_bid).'</div></td></tr>
  <tr><td class="sm_text_headi"><div id="winner_index_div_'.$sqlRow->id.'">'.$high_bidder.'</div></td></tr>
</table>
</td>';

    if($sqlRow->running=='Y')
	{  
  if($_SESSION['SESSIONUSERID']=='')
  $suggestion_auction.='<td width="30%" align="center"><div id="bid_btn_'.$sqlRow->id.'" class="big_bid_btn"><a href="index.php?show=login" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage(\'login_'.$sqlRow->id.'\',\'\',\'images/mainsite/login_btn.jpg\',1)"><img src="images/mainsite/bid_btn.gif" border="0" id="login_'.$sqlRow->id.'" /></a></div></td>';
  else
  	$suggestion_auction.='<td width="30%" align="center"><div id="bid_btn_'.$sqlRow->id.'" class="big_bid_btn"><a href="#" onclick="Add_bid('.$sqlRow1->id.')"><img src="images/mainsite/bid_btn.gif" border="0"/></a></div></td>';
	}
else
	$suggestion_auction.='<td width="30%" align="center"><div id="bid_btn_'.$sqlRow->id.'" class="pause_btn"><img src="images/mainsite/pause_btn.gif" border="0"/></div></td>';

  $suggestion_auction.='</tr>
</table>
</td></tr>

</table>
</td>
<td>&nbsp;</td>


  </tr>
    <tr>
    <td align="left"><img src="images/mainsite/live_pro_buttom.jpg" /></td>
  </tr>
  <tr><td height="8"></td></tr>
</table>
	</td>
	<td>&nbsp;</td>';
	
			if($Runngin_list=='')
				$Runngin_list=$sqlRow->id."|@|".$sqlRow->bid_counter;
			else
				$Runngin_list.=",".$sqlRow->id."|@|".$sqlRow->bid_counter;		

	$i++;
}

$suggestion_auction.='<td>&nbsp;</td>
  </tr>
</table>

</td></tr>
</table>';
}

return $suggestion_auction;

}

function scroll_auction()
{
global $Small_box,$show,$cat;
$block_auction=$this->Get_unpaid_win_auction_title();
$category_auc=$this->category_auction();

$qry="select b.* from bid as b left join bid_details as d on b.id=d.item_id where b.deleted='N' and b.status='Y' and b.start='Y' and b.end_bid!='Y' and b.auction_type!='P' and b.running='Y' and d.lang='".$_SESSION['LANG']."'";

if($show=='index' || $show=='' || $show=='listing' || $show=='category_page' || $show=='product' || $show=='pause_auction')
{
if($block_auction!='' && $_SESSION['SESSIONUSERID']!='')
	$qry.=" and d.title not in ($block_auction)";
	if($cat!='')
	{
	$qry.=" and b.category='$cat'";
		if($category_auc!='')
			$qry.=" and b.id not in ($category_auc)";
	$qry.=" order by b.sequenceid,b.end_bid,b.extends_time,b.id desc limit $Small_box,4";
	}
	else
	$qry.=" order by b.sequenceid,b.end_bid,b.extends_time,b.id desc limit $Small_box,4";
}
else
$qry.=" order by RAND() limit 0,4";


$total_row=$this->dbh->query($qry);
$TOTAL_RECORDSET=mysql_num_rows($total_row);
$Runngin_list='';

	if($TOTAL_RECORDSET>0)
	{
	while($sqlRow=mysql_fetch_object($total_row))
		{
			if($Runngin_list=='')
				$Runngin_list=$sqlRow->id."|@|".$sqlRow->bid_counter;
			else
				$Runngin_list.=",".$sqlRow->id."|@|".$sqlRow->bid_counter;	
		}
	}
	
	return $Runngin_list;

}



function product_suggestion_auc($category_id,$pro_id)
{
$block_auction=$this->Get_unpaid_win_auction_title();
$qry="select b.* from bid as b left join bid_details as d on b.id=d.item_id where b.deleted='N' and b.id!='$pro_id' and b.status='Y' and b.start='Y' and b.end_bid!='Y' and b.auction_type!='P' and b.running='Y' and d.lang='".$_SESSION['LANG']."'";
	if($block_auction!='' && $_SESSION['SESSIONUSERID']!='')
	$qry.=" and d.title not in ($block_auction)";
	if($category_id!='')
		$qry.=" and b.category='$category_id'";
	/*if($title!='')
		$qry.=" and title like '%$title%'";*/

$qry.=" order by b.sequenceid,b.end_bid,b.extends_time,b.id desc limit 0,4";


$total_row=$this->dbh->query($qry);
$TOTAL_RECORDSET=mysql_num_rows($total_row);
$Runngin_list='';

	if($TOTAL_RECORDSET>0)
	{
	while($sqlRow=mysql_fetch_object($total_row))
		{
			if($Runngin_list=='')
				$Runngin_list=$sqlRow->id."|@|".$sqlRow->bid_counter;
			else
				$Runngin_list.=",".$sqlRow->id."|@|".$sqlRow->bid_counter;	
		}
	}
	
	return $Runngin_list;

}

function product_scroll_auc($category_id,$pro_id)
{
$block_auction=$this->Get_unpaid_win_auction_title();
$qry="select b.* from bid as b left join bid_details as d on b.id=d.item_id where b.deleted='N' and b.id!='$pro_id' and b.status='Y' and b.start='Y' and b.end_bid!='Y' and b.auction_type!='P' and b.running='Y' and d.lang='".$_SESSION['LANG']."'";

	if($block_auction!='' && $_SESSION['SESSIONUSERID']!='')
	$qry.=" and d.title not in ($block_auction)";
	if($category_id!='')
		$qry.=" and b.category!='$category_id'";
	/*if($title!='')
		$qry.=" and title like '%$title%'";*/

$qry.=" order by b.sequenceid,b.end_bid,b.extends_time,b.id desc limit 0,4";

$total_row=$this->dbh->query($qry);
$TOTAL_RECORDSET=mysql_num_rows($total_row);
$Runngin_list='';

	if($TOTAL_RECORDSET>0)
	{
	while($sqlRow=mysql_fetch_object($total_row))
		{
			if($Runngin_list=='')
				$Runngin_list=$sqlRow->id."|@|".$sqlRow->bid_counter;
			else
				$Runngin_list.=",".$sqlRow->id."|@|".$sqlRow->bid_counter;	
		}
	}
	
	return $Runngin_list;

}



function register_form($SITE_URL)
{

if(strlen($sqlRow->content)>250)
	{
	$des1 = substr($sqlRow->content, 0, 250);  
	$des = $des1."..."; 
	}
else
	$des=$sqlRow->content;
			
$Content = wordwrap($des, 100, "\n", 1);
	
$register_form='<tr><td style="background: url(images/header.jpg) no-repeat;  height:184px; background-position:center;" valign="top"><table width="100%" border="0" cellspacing="10" cellpadding="20" >
  <tr>
    <td width="70%" align="right">
    <table width="85%" border="0" cellspacing="0" cellpadding="0" height="120">
  <tr>
    <td class="welcome" valign="top" align="left"><img src="images/welcome.gif" /></td>
  </tr>
  <tr>
    <td class="text" align="left" valign="top">'.$Content.'</td>
  </tr>';
  
    $register_form.='<tr>

    <td align="left"><a href="'.$SITE_URL.'/'.$Data->page_url.'" class="click"><img src="images/cleck_here.gif" border="0" /></a></td>
  </tr>';
	
  $register_form.='</table>
</td>
<td width="30%" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><a href="index.php?show=register"><img src="images/registration.jpg" border="0" /></a></td>
  </tr>
  <tr><td height="8"></td></tr>
  <tr>
    <td><a href="index.php?show=login"><img src="images/member_sign_up.jpg" border="0"/></a></td>
  </tr>
</table>
</td>
  </tr>';

return $register_form;
}


function edit_form($show)
{

if($show=='view_profile')
{
	$menu_class='menu_sub1';
	$menu_class1='menu_sub';
	$menu_class2='menu_sub';
	$menu_class3='menu_sub';
	$menu_class4='menu_sub';
	$menu_class5='menu_sub';
	$menu_class6='menu_sub';
	$menu_class7='menu_sub';
}
else if($show=='edit_profile')
{
	$menu_class='menu_sub';
	$menu_class1='menu_sub1';
	$menu_class2='menu_sub';
	$menu_class3='menu_sub';
	$menu_class4='menu_sub';
	$menu_class5='menu_sub';
	$menu_class6='menu_sub';
	$menu_class7='menu_sub';
}
else if($show=='my_bid')
{
	$menu_class='menu_sub';
	$menu_class1='menu_sub';
	$menu_class2='menu_sub1';
	$menu_class3='menu_sub';
	$menu_class4='menu_sub';
	$menu_class5='menu_sub';
	$menu_class6='menu_sub';
	$menu_class7='menu_sub';
}
else if($show=='my_setting')
{
	$menu_class='menu_sub';
	$menu_class1='menu_sub';
	$menu_class2='menu_sub';
	$menu_class3='menu_sub1';
	$menu_class4='menu_sub';
	$menu_class5='menu_sub';
	$menu_class6='menu_sub';
	$menu_class7='menu_sub';
}
else if($show=='view_reports')
{
	$menu_class='menu_sub';
	$menu_class1='menu_sub';
	$menu_class2='menu_sub';
	$menu_class3='menu_sub';
	$menu_class4='menu_sub1';
	$menu_class5='menu_sub';
	$menu_class6='menu_sub';
	$menu_class7='menu_sub';
}
else if($show=='bid_tickets')
{
	$menu_class='menu_sub';
	$menu_class1='menu_sub';
	$menu_class2='menu_sub';
	$menu_class3='menu_sub';
	$menu_class4='menu_sub';
	$menu_class5='menu_sub1';
	$menu_class6='menu_sub';
	$menu_class7='menu_sub';
}
else if($show=='tell_friend')
{
	$menu_class='menu_sub';
	$menu_class1='menu_sub';
	$menu_class2='menu_sub';
	$menu_class3='menu_sub';
	$menu_class4='menu_sub';
	$menu_class5='menu_sub';
	$menu_class6='menu_sub';
	$menu_class7='menu_sub1';
}
else if($show=='logout')
{
	$menu_class='menu_sub';
	$menu_class1='menu_sub';
	$menu_class2='menu_sub';
	$menu_class3='menu_sub';
	$menu_class4='menu_sub';
	$menu_class5='menu_sub';
	$menu_class6='menu_sub1';
	$menu_class7='menu_sub';
}
else
{
	$menu_class='menu_sub';
	$menu_class1='menu_sub';
	$menu_class2='menu_sub';
	$menu_class3='menu_sub';
	$menu_class4='menu_sub';
	$menu_class5='menu_sub';
	$menu_class6='menu_sub';
	$menu_class7='menu_sub';
}
	
$edit_form='<tr>

<td width="100%" valign="top" align="center" style="background: url(images/menu_bg2.jpg) no-repeat;  background-position:center; "><table width="750" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td class="'.$menu_class.'"><a href="index.php?show=view_profile">'.$lang['view_profile'].'&</a></td>
    <td class="'.$menu_class1.'"><a href="index.php?show=edit_profile">'.$lang['edit_profile'].'</a></td>
	<td class="'.$menu_class3.'"><a href="index.php?show=my_setting">'.$lang['my_setting'].'</a></td>
	<td class="'.$menu_class4.'"><a href="index.php?show=view_reports">'.$lang['sms_report'].'</a></td>
	<td class="'.$menu_class5.'"><a href="index.php?show=bid_tickets">'.$lang['bid_ticket'].'</a></td>
	
	
  </tr>
  
</table>
</td>
  </tr>
  <tr><td></td></tr>
  <tr><td align="right">
  <table width="92%" border="0" cellspacing="0" cellpadding="0">
  <tr><td width="510"></td>
  <td width="8" width="120"><img src="images/submenu_bgleft.jpg" /></td>
  <td class="sub_menu">
  <table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
  <td class="balance">
  <b>'.$lang['bids'].'</b> : <font color="#FF0000">'.$balance.'</font></td>
  <td class="sub_menu1"><a href="index.php?show=tell_friend">'.$lang['tell_frend'].'</a></td>
  <td class="menu">&nbsp;|&nbsp;</td>
  <td class="sub_menu1"><a href="index.php?show=logout">'.$lang['logout'].'</a></td>
  </tr></table></td>
   <td><img src="images/submenu_bgright.jpg" /></td>
   <td width="75"></td></tr></table></td>
 
  </tr>';

return $edit_form;
}

function left_news()
{
global $lang;

$left_news='<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr><td height="5"></td></tr>';
		
		$year=substr($Data->entrydate, 0, 4);  
		$month=substr($Data->entrydate, 5, 2); 
		$date=substr($Data->entrydate, 8, 2);  
	
	if($month<10)
		$month=str_replace("0", "", $month);
		
	if($month=='1')
		$Current_month='January';
	if($month=='2')
		$Current_month='February';
	if($month=='3')
		$Current_month='March';
	if($month=='4')
		$Current_month='April';
	if($month=='5')
		$Current_month='May';
	if($month=='6')
		$Current_month='June';
	if($month=='7')
		$Current_month='July';
	if($month=='8')
		$Current_month='August';
	if($month=='9')
		$Current_month='September';
	if($month=='10')
		$Current_month='October';
	if($month=='11')
		$Current_month='November';
	if($month=='12')
		$Current_month='December';
		
 $left_news.='<tr><td>
 <table width="90%" cellpadding="0" cellspacing="0" border="0" align="center">
 <tr>
    <td class="text_info1">On '.$Current_month.' '.$date.','.$year.'</td>
  </tr>
  <tr>
    <td class="news_Header1">'.$Data->heading.'</td>
  </tr>
  <tr>
    <td class="text_info1">'.$news_des.'</td>
  </tr>
  <tr><td height="5"></td></tr>
  <tr><td class="text_info1"><a href="index.php?show=news_detail&id='.$Data->id.'">'.$lang['mor'].'</a></td></tr>
  </table></td></tr>
  <tr><td height="5"></td></tr>';
  	}


}



//////////////////////////  Starting of Footer Function   //////////////////////////////

function footer($SITE_URL)
{
	global $footer;	
		
	$footer_main='   <div id="Layer4" style="position:absolute; left:214px; top:575px; width:594px; height:24px; z-index:19; background-image: url(assets/ornaments/lijnonder.gif); layer-background-image: url(assets/ornaments/lijnonder.gif); border: 1px none #000000;"></div>
  <div id="adresbottom" style="position:absolute; left:229px; top:605px; width:552px; height:41px; z-index:15;">
    <div align="center" class="style1">
      <div id="Layer3" style="position:absolute; width:439px; height:25px; z-index:13; left: 77px; top: -2px;">
        <table width="100%"  border="0" cellpadding="0" cellspacing="0" id="txtadres">
          <tr>
            <td><div align="center" class="style6">&copy; 2014 - KINI - Jl. Wates Km.12, Gubug Argosari, Sedayu, Bantul<br>
              Yogyakarta 55183 Indonesia </div></td>
          </tr>
        </table>
      </div>
    </div>
  </div>';
  	
	return $footer_main;
}



//////////////////////////  Ending of Footer Function   //////////////////////////////

//================ GET FLAGS LIST=============
function Get_flags($show)
	{
	global $lang,$SITE_URL;
	$pieces=explode('/',$_SERVER['PHP_SELF']);
	if($pieces[3]=='sim.php')
		$fullshow="/authorise.net/sim.php?".$show;
	else
		$fullshow="/index.php?".$show;
 $Flags='<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr>';	
	$flagselect=$this->dbh->query("select * from language_setting where status='Y'");
	while($rows=@mysql_fetch_object($flagselect))
	{	
	$Flags.='<td><a href="'.$SITE_URL.''.$fullshow.'&ltype='.$rows->id.'"><img src="'.$rows->lang_flag.'" border=0 alt="'.$rows->language_title.'" ></a></td>';
	}
	
	$Flags.='</tr>
		</table>';
	return $Flags;
	}	

//=================== SEND A MAIL =======================
function Send_mail($Site_mail,$Title,$Email,$Subject,$Message)
	{
			$mail = new PHPMailer();
			
			$mail->From  = $Site_mail;							//site url of sender 
			$mail->FromName = $Title;						//site title of sender
			$mail->AddAddress($Email);						// email address of reciever
			$mail->WordWrap = 50;                              // set word wrap
			$mail->IsHTML(true);                               // send as HTML
			$mail->Subject  =  $Subject;						// subject of mail
			$mail->Body     =  $Message;						// body of mail
			
			$mail->Send();
	}
	
function Get_Country($country)
 	{
	$qry1="SELECT * FROM country order by id";
	$Res=$this->dbh->query($qry1);
			
	$Country_dropdown='<select name="id_country" class="select_drop" style="width:135px;">';
	while($row=mysql_fetch_object($Res))
		{
		 if($country==$row->id)
			$Country_dropdown.='<option value='.$row->id.' selected>'.$row->name.'</option>';
		 else
			$Country_dropdown.='<option value='.$row->id.'>'.$row->name.'</option>';	
		}						
							
		    $Country_dropdown.='</select>';
	
	
		return $Country_dropdown;	

	}	
//END OF FUNCTION	

function Get_Friend_Email($freind_id)
{
	$Resultl=$this->dbh->query("select user_id,email from users where md5(user_id)='$freind_id' and deleted='N' and active='Y' and status='Y'");
	
	$friend_email='<select name="friendemail" class="select_drop">';
	while($row=mysql_fetch_object($Resultl))
		{
			$friend_email.='<option value='.$row->user_id.'>'.$row->email.'</option>';	
		}						
							
		    $friend_email.='</select>';

		return $friend_email;	
}

function Get_Country_value($country)
 	{
	$qry1="SELECT * FROM country where id='$country'";
	$Res=$this->dbh->query($qry1);
	
	$row=mysql_fetch_object($Res);
	return $row->name;	

	}	
//END OF FUNCTION	

//========================= GET BID TIME =====================

function Get_bid_time($bid_id)
	{
	$sqlResult=$this->dbh->query("select * from bid where id='$bid_id'");
	$Data=@mysql_fetch_object($sqlResult);
	
	$Entrydate=explode(" ",$Data->entrydate);
	$Date_array=explode("-",$Entrydate[0]);
	$Time_array=explode(":",$Entrydate[1]);
	$Start_time=mktime($Time_array[0], $Time_array[1],$Time_array[2], $Date_array[1], $Date_array[2], $Date_array[0]);
	
	$End_time=($Start_time+($Data->hours*3600));
	$Remain_time=($End_time-$CURRENT_TIME);  

	
	$Bid_remaingtime=$this->hhmmss($Remain_time);
	
	return $Bid_remaingtime;
	}

function Get_mobile_number($bid_id)
	{
	$sqlResult=$this->dbh->query("select mobile_no from add_bids where item_id='$bid_id' order by id desc");
	$Data=@mysql_fetch_object($sqlResult);
	
	return $Data->mobile_no;
	}
	

function hhmmss($length) 
{
	$hrs = floor($length / 3600);
	$min = $length - $hrs * 3600;
	$min = floor($min / 60);
	$sec = $length - $hrs * 3600 - $min * 60;
	return	str_pad($hrs,2,'0',STR_PAD_LEFT) . ':' .
		str_pad($min,2,'0',STR_PAD_LEFT) . ':' .
		str_pad($sec,2,'0',STR_PAD_LEFT);
}


//============================ GET Timestamp=====================================
function get_timestamp($date)
{
	
	$yy=substr($date, 0, 4)."<br/>";
	$mm=substr($date, 5, 2)."<br/>";
	$dd=substr($date, 8, 2)."<br/>";
	
	$timestamp=mktime(0,0,0,$mm,$dd,$yy);
	
	return $timestamp;
}


//============================ GET Timestamp=====================================
function get_com_timestamp($time, $date)
{
	$yy=substr($date, 0, 4);
	$mm=substr($date, 5, 2);
	$dd=substr($date, 8, 2);
	
	$hh=substr($time, 0, 2);
	$mm1=substr($time, 3, 2);
	$ss=substr($time, 6, 2);

	$timestamp=mktime($hh,$mm1,$ss,$mm,$dd,$yy);
	
	return $timestamp;
}
	

//===================== GET MONTH DROPDOWN===================

function Get_month($Month)
	{
$Month_array = array(1=>"January","February","March","April","May","June","July","August","September","October","November","December");

$Month_dropdown='<select name="Date_Month" id=Date_Month>';

while (list($key, $value) = each($Month_array))
	 {
	 	if($key==$Month)
			$Month_dropdown.='<option value="'.$key.'" selected>'.$value.'</option>';
		else
			$Month_dropdown.='<option value="'.$key.'">'.$value.'</option>';
			
	 }	
$Month_dropdown.='</select>';	

return  $Month_dropdown;
	} 
	
	
//===================== GET DAY DROPDOWN===================

function Get_day($day)
	{
	$Day_dropdown='<select name="Date_Day" id=Date_Day>';

	$i=1;
while ($i<=31)
	 {
	 	if($i==$day)
			$Day_dropdown.='<option value="'.$i.'" selected>'.$i.'</option>';
		else
			$Day_dropdown.='<option value="'.$i.'">'.$i.'</option>';
		$i++;	
	 }	
	$Day_dropdown.='</select>';	

	return  $Day_dropdown;
	} 	

//===================== GET DAY DROPDOWN===================

function Get_Year($year)
	{
	$Year_dropdown='<select name="Date_Year" id=Date_Year>';

	
	$Start_year=date("Y")-100;
	$End_year=date("Y")-18;
	
while ($End_year>=$Start_year)
	 {
	 	if($End_year==$year)
			$Year_dropdown.='<option value="'.$End_year.'" selected>'.$End_year.'</option>';
		else
			$Year_dropdown.='<option value="'.$End_year.'">'.$End_year.'</option>';
		$End_year--;	
	 }	
	$Year_dropdown.='</select>';	

	return  $Year_dropdown;
	} 	
	
//========================= GET USER DETAILS ===================

function Get_user($user_id,$field)
	{
	$Res=$this->dbh->query("select $field from users where user_id='$user_id'");
	$Data=@mysql_fetch_array($Res);
	return $Data[0];

	}		

function Get_username($user_id)
	{
	$Res=$this->dbh->query("select username from users where user_id='$user_id'");
	$Data=@mysql_fetch_object($Res);
	return $Data->username;

	}	

function Get_blank_password()
	{
	$Res=$this->dbh->query("select * from users where (mobile='' or password='') and  user_id='".$_SESSION['SESSIONUSERID']."'");

	if(@mysql_num_rows($Res)>0)
		echo '<script>document.location="index.php?show=edit_profile&error=4";</script>';
	}
	

function Get_unpaid_win_auction()
	{
	$qry="select bid_id from winners where user_id='".$_SESSION['SESSIONUSERID']."' group by bid_id";
	
	$total_row=$this->dbh->query($qry);
	
	$TOTAL_RECORDSET=mysql_num_rows($total_row);
	$Runngin_list='';

	if($TOTAL_RECORDSET>0)
	{
	while($sqlRow=mysql_fetch_object($total_row))
		{
			$Result=$this->dbh->query("select paystatus from account where  user_id='".$_SESSION['SESSIONUSERID']."' and paystatus='TRUE' and  item_id='$sqlRow->bid_id'");
			if(@mysql_num_rows($Result)==0)
			{
			if($Runngin_list=='')
				$Runngin_list=$sqlRow->bid_id;
			else
				$Runngin_list.=",".$sqlRow->bid_id;	
			}
		}
	}
	
	return $Runngin_list;
	}
	
function Get_unpaid_user_block()
	{
		$ip=$_SERVER[REMOTE_ADDR];
		$this->dbh->query("select ip from core_block_by_ip where ip='".IP::dotToLongIP($ip)."'");
	if($this->dbh->num_rows()==0)
		$this->dbh->query("insert into core_block_by_ip values('".IP::dotToLongIP($ip)."', 'N', 'Not Payed Winning Auction', '$ip')");
		
		$untill1=date("Y-m-d", mktime(0,0,0, date('m'), days_in_month(date('m'), date('Y')), date('Y')+4));
		$untill=$this->revdate1($untill1);
		$this->dbh->query("select * from core_block_by_member where member_id='".$_SESSION['SESSIONUSERID']."'");
		if($this->dbh->num_rows()==0)
		$this->dbh->query("insert into core_block_by_member(member_id,block_datetime,block_until_datetime,reason) values('".$_SESSION['SESSIONUSERID']."', '".date('Y-m-d')."', '$untill', 'Not Payed Winning Auction')");
	 
		 $sql="update users set blocked='Y' where user_id='".$_SESSION['SESSIONUSERID']."'";
		 $this->dbh->query($sql); 

	}
	
function Get_unpaid_user_unblock()
	{
		$ip=$_SERVER[REMOTE_ADDR];
		$new_ip=IP::dotToLongIP($ip);
		$this->dbh->query("select ip from core_block_by_ip where ip='".IP::dotToLongIP($ip)."'");
		if($this->dbh->num_rows()>0)
		$this->dbh->query("delete from core_block_by_ip where ip='$new_ip'");
		
		$this->dbh->query("select * from core_block_by_member where member_id='".$_SESSION['SESSIONUSERID']."'");
		if($this->dbh->num_rows()>0)
		{
			$this->dbh->query("delete from core_block_by_member where member_id='".$_SESSION['SESSIONUSERID']."'");
			$this->dbh->query("update users set blocked='N' where user_id='".$_SESSION['SESSIONUSERID']."'"); 
		}

	}
	

function Get_bid_rate($item_id)
	{
	$Res=$this->dbh->query("select bid_rate from bid where id='$item_id'");
	$Data=@mysql_fetch_object($Res);
	return $Data->bid_rate;

	}
	
function Get_auction_code($item_id)
	{
	$Res=$this->dbh->query("select auction_code from bid where id='$item_id'");
	$Data=@mysql_fetch_object($Res);
	return $Data->auction_code;

	}

	
function Get_firstname($user_id)
	{
	$Res=$this->dbh->query("select fname from users where user_id='$user_id'");
	$Data=@mysql_fetch_object($Res);
	return $Data->fname;

	}
	
function Get_lastname($user_id)
	{
	$Res=$this->dbh->query("select lname from users where user_id='$user_id'");
	$Data=@mysql_fetch_object($Res);
	return $Data->lname;

	}
	
function Get_city($user_id)
	{
	$Res=$this->dbh->query("select city from users where user_id='$user_id'");
	$Data=@mysql_fetch_object($Res);
	return $Data->city;

	}
//=========================GET BID END Time=====================
function Get_Bid_end_time($item_id)
{
	$Qry="select bid_time from add_bids where bid_rate=(Select max(bid_rate) from add_bids where item_id='$item_id')";
	$Res=$this->dbh->query($Qry);
	$Data=@mysql_fetch_object($Res);

	$Bid_remaingtime=date("m-d-Y H:i:s",$Data->bid_time);
	
	return $Bid_remaingtime;
}
	
//========================= GET Max Min Bids ===================

function Get_Bid($item_id,$Bid_type)
	{
	
	if($Bid_type=='Max')
		$Qry="Select max(bid_rate) from add_bids where item_id='$item_id'"; 
	else if($Bid_type=='Min')
		$Qry="Select min(bid_rate) from add_bids where item_id='$item_id'"; 
	else if($Bid_type=='Total')
		 $Qry="Select count(*) from add_bids where item_id='$item_id'";	
		
	$Res=$this->dbh->query($Qry);
	$Data=@mysql_fetch_array($Res);
	
	if($Data[0])
		return $Data[0];
	else
		{
		if($Bid_type=='Total')
			return 0;
		else
			{
				$Res1=$this->dbh->query("Select bid_rate from bid where id='$item_id'");
				$Data1=@mysql_fetch_array($Res1);	
				return $Data1[0];
			}	
		}	
	}
	
function Get_idmaxbid($last_mobile,$bid_id)
{
    $final_mobile_number=substr($last_mobile,-4, 4);
    $Qry="select bid_type, user_id from add_bids where item_id='$bid_id' and mobile_no='$last_mobile' order by (Select max(bid_rate) from add_bids where item_id='$bid_id') desc";
	$Res=$this->dbh->query($Qry);
	$Data=@mysql_fetch_object($Res);
	if($Data->bid_type=='A')
		$name=$this->Get_user($Data->user_id,'username');
    else
	    $name=$final_mobile_number;	
			 
	return $name;	 
	     
}	

function Get_idmaxbid_closed($last_mobile,$bid_id)
{
    $final_mobile_number=substr($last_mobile, -4, 4);
    $Qry="select bid_type, user_id from add_bids where item_id='$bid_id' and mobile_no='$last_mobile' order by (Select max(bid_rate) from add_bids where item_id='$bid_id') desc";
	$Res=$this->dbh->query($Qry);
	$Data=@mysql_fetch_object($Res);
	if($Data->bid_type=='A')
	{
	     $firstname=$this->Get_firstname($Data->user_id);
		 $lastname=$this->Get_lastname($Data->user_id);
		 $city=$this->Get_city($Data->user_id);
		 //$name=$firstname." ".$lastname." ".$city;
		 $name=$this->Get_username($Data->user_id);
	}
    else
	    $name=$final_mobile_number;	
			 
	return $name;	 
	     
}		
	


function Get_Block_User($user_id)
{
	$current=date('Y-m-d H:i:s');
	$Res=$this->dbh->query("select * from core_block_by_member where member_id='$user_id' and block_until_datetime>'".$current."'");
	return @mysql_num_rows($Res);
}

function Get_Status_User($user_id)
{
	$Res=$this->dbh->query("select status from users where user_id='$user_id'");
	$Data=@mysql_fetch_object($Res);
	return $Data->status;
}

function get_category_name($cat_id)
{
$fieldname="cat_name".$_SESSION['LANG']; 
	$Res=$this->dbh->query("select $fieldname from category where id='$cat_id'");
	$Data=@mysql_fetch_array($Res);
	return $Data[0];
}

function Get_Auction_Mail($user_id)
{
	$Res=$this->dbh->query("select 
	auction_bid from my_setting where user_id='$user_id'");
	$Data=@mysql_fetch_array($Res);
	return $Data[0];
}

function image_resizing($maxWidth,$maxHeight,$webDir,$images,$ext)
{ 
						$localDir ='';
				         $AutorisedImageType = array ("jpg", "jpeg", "gif", "png", "JPG", "JPEG", "GIF");     
						      global $newWidth;
				              global $newHeight;

					      list($width, $height, $type, $attr) = @getimagesize( $localDir.$images);

                          $xRatio = $maxWidth / $width;
                          $yRatio = $maxHeight / $height;
          
                          if ( ($width <= $maxWidth) && ($height <= $maxHeight) )
						   {
                            $newWidth = $width;
                            $newHeight = $height;
                          	}
                          else if (($xRatio * $height) < $maxHeight)
						  	 {
                            	$newHeight = ceil($xRatio * $height);
                            	$newWidth = $maxWidth;
                          	}
                          	else {
                            	$newWidth = ceil($yRatio * $width);
                            	$newHeight = $maxHeight;
                          		}
							$size=$newWidth.'.'.$newHeight;	
				           
						 return $size;	         
						 }  
						 
function Time_Format($t1)
{
	$ar1=explode(":", $t1);
	if($ar1[0]>=12)
	{	
		$st1=$ar1[0]-12;
		return $st1.':'.$ar1[1].':'.$ar1[2].' PM';
	}
	else
	{
		return $t1.' AM';
	}	
}	




function get_category($category)
{
$fieldname="cat_name".$_SESSION['LANG']; 

$Res=$this->dbh->query("select $fieldname from category where deleted='N' and id='$category'");
$Data=@mysql_fetch_array($Res);
return $Data[0];
}

function Time_Format24($t1)//12:20:00 PM
{
	$ar1=explode(":", $t1);	
	$ar2=explode(" ", $ar1[2]);
	if($ar2[1]==AM)
	{
		return $ar1[0].':'.$ar1[1].':'.$ar2[0];
	}
	else
	{
		if($ar1[0]==12)
			$st1=12;
		else
			$st1=$ar1[0]+12;
		return $st1.':'.$ar1[1].':'.$ar2[0];
	}
}	


function Time_Format12($t1)//23:20:00
{
	$ar1=explode(":", $t1);
	if($ar1[0]>=12)
	{
	 if($ar1[0]==12)
	{
	 $st1=12;
	 return $st1.':'.$ar1[1].':'.$ar1[2].' PM';
	 }
	 if($ar1[0]==23)
	{
	   $st1=11;
	  return $st1.':'.$ar1[1].':'.$ar1[2].' PM';
	 }
	 if($ar1[0]==22)
	{
	   $st1=10;
	  return $st1.':'.$ar1[1].':'.$ar1[2].' PM';
	 }
	if($ar1[0]>=9)
	{
		$st1=$ar1[0]-12;
		return '0'.$st1.':'.$ar1[1].':'.$ar1[2].' PM';
	}
	}
	else
	{
		return $t1.' AM';
	}	
}


function revdate1($date)
{
	 $date1=explode("-",$date);	
	 $currdate=$date1[2].'-'.$date1[1].'-'.$date1[0];
	 return $currdate;
}
						 
function Get_auction($item_id)
{
	$sql="select auction_code from bid where id='$item_id'";
	$sqlResult=$this->dbh->query($sql);
	$sqlRow=mysql_fetch_object($sqlResult);
	return $sqlRow->auction_code;
}
function Get_auction_name($item_id)
{
	$sql="select title from bid_details where item_id='$item_id'";
	$sqlResult=$this->dbh->query($sql);
	$sqlRow=mysql_fetch_object($sqlResult);
	
	$Item_title=ucfirst($sqlRow->title);
			
	return $Item_title;
}
function get_date_format($g_date)
{
	$check=explode(" ",$g_date);
	$date=$check[0]; 
	$time=$check[1];
    $right_date=$this->revdate1($date);

	$date_format=$time." ".$right_date;

	return $date_format;
}
function get_date_format1($g_date)
{
	$check=explode(" ",$g_date);
	$date=$check[0]; 
	$time=$check[1];
    $right_date=$this->revdate1($date);

	$date_format=$right_date;

	return $date_format;
}

function Get_main_auction()
{
	$sqlResult=$this->dbh->query("select id from bid where main_auction='Y' and status='Y' and deleted='N' and end_bid!='Y' order by running,end_bid desc,extends_time limit 0,1");
	$sqlRow=@mysql_fetch_object($sqlResult);
	
	return $sqlRow->id;
}
//=============Get Auction Status====================

function Get_auction_status($item_id)
{
global $lang;
$sql="select running,end_bid from bid where id='$item_id'";
	$sqlResult=$this->dbh->query($sql);
	$sqlRow=mysql_fetch_object($sqlResult);
	
	if($sqlRow->end_bid!='Y')
	{
		if($sqlRow->running=='Y')
			$status=$lang['running_lots'];
		else if($sqlRow->running=='N')
			$status=$lang['Paused'];
	}
	else
		$status=$lang['expired_lots'];
		
	return $status;
}
function Get_user_status($user_id)
{
	$sql="select status from users where user_id='$user_id'";
	$sqlResult=$this->dbh->query($sql);
	$sqlRow=mysql_fetch_object($sqlResult);
	return $sqlRow->status;
}

function start_auction()
{
	
	$Today=$CURRENT_DATE;			
	$current_time=$CURRENT_TIME; 
	
		$Res=$this->dbh->query("select start_auction,pause_time,end_auction,entrydate,end_bid,hours,start_pause,id,running,update_extend,timer_value,auction_type from bid where status='Y' and start='Y' and deleted='N' and end_bid!='Y'");
		while($Data=@mysql_fetch_object($Res))
		{
		$start_auc_time=$this->get_com_timestamp($Data->start_auction,$Today); 
		$end_auc_time=$this->get_com_timestamp($Data->end_auction,$Today);  
		
		if($Data->auction_type=='M')
		{	
		if($current_time>$start_auc_time && $current_time<$end_auc_time)
			{
			if($Data->running=='N')	
				{
				if($Data->start_pause=='Y')
					{
					if($Data->update_extend!='')
						{
						$update_extend=($Data->update_extend+$CURRENT_TIME);	
						$sql=$this->dbh->query("update bid set running='Y',update_extend='$update_extend' where id='$Data->id'");
						}
					else
					{
						$sql=$this->dbh->query("update bid set running='Y' where id='$Data->id'");	
						$Res=$this->dbh->query("select user_id from reminder where item_id='$Data->id' and rem_type='C' and status='N' and deleted='N'");
						if(@mysql_num_rows($Res))
						{
							while($Data=@mysql_fetch_object($Res))
							{						
							$user_email=$this->Get_useremail($Data->user_id);
							$user_name=$this->Get_username($Data->user_id);
							
							$Email_info=$this->Email_info(20);
							$subject=$Email_info['subject'];
							
							$msgBody=$Email_info["message"];
							//$msgBody=str_replace("\"", "'", $msgBody);
							eval("\$msgBody = \"$msgBody\";");
							
							$this->Send_mail($user_email,$user_name,$SITE_EMAIL, $subject, $msgBody);	
							//mail sending to the set reminder user
							}
						}
						
					}

					}
				}
			}
		else
			{
			if($Data->running=='Y')	
				{
				$update_extend=$Data->update_extend-$CURRENT_TIME;	
				$sql=$this->dbh->query("update bid set running='N',update_extend='$update_extend' where id='$Data->id'");
				}
			} 
		}
		else
		{
			if($current_time>$start_auc_time)
			{
			if($Data->running=='N')	
				{
				if($Data->start_pause=='Y')
					{
					if($Data->update_extend!='')
						{
						$update_extend=($Data->update_extend+$CURRENT_TIME);	
						$sql=$this->dbh->query("update bid set running='Y',update_extend='$update_extend' where id='$Data->id'");
						}
					else
					{
					$sql=$this->dbh->query("update bid set running='Y' where id='$Data->id'");	
					
					$Res=$this->dbh->query("select user_id from reminder where item_id='$Data->id' and rem_type='C' and status='N' and deleted='N'");
						if(@mysql_num_rows($Res))
						{
							while($Data1=@mysql_fetch_object($Res))
							{						
							$user_email=$this->Get_useremail($Data1->user_id);
							$user_name=$this->Get_username($Data1->user_id);
							$admin_email=$this->Get_adminemail();
							$site_title=$this->Get_sitetitle();
							
							$Email_info=$this->Email_info(20);
							$subject=$Email_info['subject'];
							
							$msgBody=$Email_info["message"];
							//$msgBody=str_replace("\"", "'", $msgBody);
							eval("\$msgBody = \"$msgBody\";");
							
							$this->Send_mail($admin_email,$site_title,$user_email,$subject,$msgBody);	
							//mail sending to the set reminder user
							
							$sql=$this->dbh->query("update reminder set status='Y' where id='$Data1->id'");
							}
						}
					}

					}
				}
			}
		}
		}
	
}




function Email_info($id)
 	{

	$Res=$this->dbh->query("select subject,message from email where id='$id'");
	$Data=@mysql_fetch_array($Res);
	return $Data;
	}
	
function Get_useremail($user_id)
	{
	$Res=$this->dbh->query("select email from users where user_id='$user_id'");
	$Data=@mysql_fetch_object($Res);
	return $Data->email;
	}
	
function Get_adminemail()
	{
	$Res=$this->dbh->query("select site_email from general_setting where id=1");
	$Data=@mysql_fetch_object($Res);
	return $Data->site_email;
	}
	
function Get_sitetitle()
	{
	$Res=$this->dbh->query("select site_title from general_setting where id=1");
	$Data=@mysql_fetch_object($Res);
	return $Data->site_title;
	}			

	//
	//Function for blocked ip
	//
	function blocked_ip()
	{
		$ip=$_SERVER['REMOTE_ADDR'];
		$query="select * from core_block_by_ip where ip='".IP::dotToLongIP($ip)."' and site_access='N'";
		$sqlResult=$this->dbh->query($query);
		$sqlRow=mysql_fetch_object($sqlResult);
		if($sqlRow->ip)
			echo"<script>window.location.href='index.php?show=blocked_ip';</script>";
	}//End blocked ip
	
	//
	//Function for blocked ip for whole site
	//
	function whole_site()
	{
		$ip=$_SERVER['REMOTE_ADDR'];
		$query="select * from core_block_by_ip where ip='".IP::dotToLongIP($ip)."' and site_access='Y'";
		$sqlResult=$this->dbh->query($query);
		$sqlRow=mysql_fetch_object($sqlResult);
		if($sqlRow->ip)
			echo"<script>window.location.href='index.php?show=blocked_ip&divert=1';</script>";
	}//End blocked ip

function bidbutler_type($user_id)
{
	$Res2=$this->dbh->query("select bidbutler_type from add_bids where user_id='$user_id'");
$Data2=@mysql_fetch_object($Res2);
if($Data2->bidbutler_type=='S')
 	return $Bid_Type=$lang['SingleBid'];
else if($Data2->bidbutler_type=='B')
	return $Bid_Type=$lang['Bidbulter'];
else
    return 	$Bid_Type='-----';
}

function Get_auto_auction_code()
	{
	$string = 'dfsicjkxcvXSNxmaOZpqxnQDlaciwalaciAghakckUIy';
	$shuffle = str_shuffle($string);
	$random_chars = substr($shuffle, 0, 4);
	$random_chars2 = substr(str_shuffle('dfsicjkxcvXSNxmaOZpqxnQDlaciwalaciAghakckUIy'), 0, 4);
	return strtoupper($random_chars2);
	}

function Make_images($uploaddir,$filename0)
	{
	
			$thumb_width = 65;
			$thumb_height = 65;
			$thumb_ratio = round($thumb_width/$thumb_height, 2);
			
			$thumb_width1 = 114;
			$thumb_height1 = 85;
			$thumb_ratio1 = round($thumb_width1/$thumb_height1, 2);
			
			$thumb_width2 = 185;
			$thumb_height2 = 165;
			$thumb_ratio2 = round($thumb_width2/$thumb_height2, 2);
			
			$thumb_width3 = 400;
			$thumb_height3 = 310;
			$thumb_ratio3 = round($thumb_width3/$thumb_height3, 2);

			@chmod($uploaddir."/".$filename0, 0755);
			list($width, $height, $type, $attr) = @getimagesize("$uploaddir/$filename0");
			//get ratio of width/height
			
			$ratio = round($width/$height, 2);
			
			//make a basic thumbnail
				if($ratio > $thumb_ratio){
					//picture is too wide so we will set the the width to its maximum
					$new_width = $thumb_width;
					$new_height = ceil(($thumb_width*$height)/$width);
				} elseif($ratio < $thumb_ratio){
					//picture is too high so we will set the height to its maximum
					$new_width = ceil(($thumb_height*$width)/$height);
					$new_height = $thumb_height;
				} else {
					//the ratio of the image is the same as the thumbnail
					$new_width = $thumb_width;
					$new_height = $thumb_height;
				}
				
				//time to resize the image and crop it for thumbnail
				$imageEditor = new ImageEditor($filename0, $uploaddir . "/");
				//resize
				$imageEditor->resize($new_width, $new_height);
				//save
				$imageEditor->outputFile($filename0, $uploaddir . "/65N65/");	
			
			
			//make a basic thumbnail
				if($ratio > $thumb_ratio1){
					//picture is too wide so we will set the the width to its maximum
					$new_width1 = $thumb_width1;
					$new_height1 = ceil(($thumb_width1*$height)/$width);
				} elseif($ratio < $thumb_ratio1){
					//picture is too high so we will set the height to its maximum
					$new_width1 = ceil(($thumb_height1*$width)/$height);
					$new_height1 = $thumb_height1;
				} else {
					//the ratio of the image is the same as the thumbnail
					$new_width1 = $thumb_width1;
					$new_height1 = $thumb_height1;
				}
				
				//time to resize the image and crop it for thumbnail
				$imageEditor = new ImageEditor($filename0, $uploaddir . "/");
				//resize
				$imageEditor->resize($new_width1, $new_height1);
				//save
				$imageEditor->outputFile($filename0, $uploaddir . "/114N85/");	

			
			//make a basic thumbnail
				if($ratio > $thumb_ratio2){
					//picture is too wide so we will set the the width to its maximum
					$new_width2 = $thumb_width2;
					$new_height2 = ceil(($thumb_width2*$height)/$width);
				} elseif($ratio < $thumb_ratio2){
					//picture is too high so we will set the height to its maximum
					$new_width2 = ceil(($thumb_height2*$width)/$height);
					$new_height2 = $thumb_height2;
				} else {
					//the ratio of the image is the same as the thumbnail
					$new_width2 = $thumb_width2;
					$new_height2 = $thumb_height2;
				}
				
				//time to resize the image and crop it for thumbnail
				$imageEditor = new ImageEditor($filename0, $uploaddir . "/");
				//resize
				$imageEditor->resize($new_width2, $new_height2);
				//save
				$imageEditor->outputFile($filename0, $uploaddir . "/185N165/");
		
				//make a basic thumbnail
				if($ratio > $thumb_ratio3){
					//picture is too wide so we will set the the width to its maximum
					$new_width3 = $thumb_width3;
					$new_height3 = ceil(($thumb_width3*$height)/$width);
				} elseif($ratio < $thumb_ratio3){
					//picture is too high so we will set the height to its maximum
					$new_width3 = ceil(($thumb_height3*$width)/$height);
					$new_height3 = $thumb_height3;
				} else {
					//the ratio of the image is the same as the thumbnail
					$new_width3 = $thumb_width3;
					$new_height3 = $thumb_height3;
				}
				
				//time to resize the image and crop it for thumbnail
				$imageEditor = new ImageEditor($filename0, $uploaddir . "/");
				//resize
				$imageEditor->resize($new_width3, $new_height3);
				//save
				$imageEditor->outputFile($filename0, $uploaddir . "/400N310/");
	}


function get_used_frequency($today_start,$today_end,$parent_id)
{
	$Qry11="select * from bid where parent_auction='$parent_id' and UNIX_TIMESTAMP(entrydate) between '$today_start' and '$today_end'";
	$Res11=$this->dbh->query($Qry11);
	$Count=@mysql_num_rows($Res11);
	
	return $Count;
}

function Auto_bid_dummy($item_id,$total_robot)
{
	$user_list=array();
	
	$Max_user=$this->Get_Maxdummyuser($item_id);
	
	$sql="select user_id from users where user_type='dummy' and user_id!='$Max_user' and deleted='N' and status='Y' order by RAND() limit 0,$total_robot";
	$sqlResult=$this->dbh->query($sql);
	while($data=mysql_fetch_object($sqlResult))
	{
		$user_list[].=$data->user_id;
	}
	return $user_list;
}


function Get_Maxdummyuser($item_id)
{
    $Qry="select user_id from add_bids where item_id='$item_id' and bid_rate=(Select max(bid_rate) from add_bids where item_id='$item_id') order by (Select max(bid_rate) from add_bids where item_id='$item_id') limit 1";
	$Res=$this->dbh->query($Qry);
	$Data=@mysql_fetch_object($Res);

	return $Data->user_id;
}



function Auto_bid_user($item_id,$bid_value)
{
	$user_list=array();
	
	$Max_user=$this->Get_Maxuser($item_id);
	
	$sql="select user_id from auto_bid where item_id='$item_id' and user_id!='$Max_user' and $bid_value between bid_from and bid_to and deleted='N' and status='Y' group by user_id order by id desc";
	$sqlResult=$this->dbh->query($sql);
	while($data=mysql_fetch_object($sqlResult))
	{
		$user_list[].=$data->user_id;
	}
	return $user_list;
}

function Get_Maxuser($item_id)
{
	
    $Qry="select user_id from add_bids where item_id='$item_id' and bid_rate=(Select max(bid_rate) from add_bids where item_id='$item_id') order by (Select max(bid_rate) from add_bids where item_id='$item_id') limit 1";
	$Res=$this->dbh->query($Qry);
	$Data=@mysql_fetch_object($Res);
	
	$active_autobid_bidfrom=$this->Get_Active_Autobid($item_id,$Data->user_id);
	$Max_add_bids=$this->Get_Total_Bid($item_id,$Data->user_id,$active_autobid_bidfrom);	
	$Max_total_bids=$this->Get_Totalbids($item_id,$Data->user_id);	
	
	if($Max_add_bids<$Max_total_bids)	 
		return $Data->user_id;
	else
		return 0;	 
}

function Get_Highest_Bidder($item_id)
{
    $Qry="select user_id from add_bids where item_id='$item_id' and bid_rate=(Select max(bid_rate) from add_bids where item_id='$item_id') order by (Select max(bid_rate) from add_bids where item_id='$item_id') limit 1";
	$Res=$this->dbh->query($Qry);
	$Data=@mysql_fetch_object($Res);

	return $Data->user_id;
}

function Get_Highest_Bidder_Mobile($item_id)
{
    $Qry="select mobile_no from add_bids where item_id='$item_id' and bid_rate=(Select max(bid_rate) from add_bids where item_id='$item_id') order by (Select max(bid_rate) from add_bids where item_id='$item_id') limit 1";
	$Res=$this->dbh->query($Qry);
	$Data=@mysql_fetch_object($Res);

	return $Data->mobile_no;
}

function Get_Total_addbids($item_id,$user_id)
{
	
    $Qry="select * from add_bids where item_id='$item_id' and bid_type='A' and bidbutler_type='B' and user_id='$user_id' and deleted='N'";
	$Res=$this->dbh->query($Qry);
	$total=@mysql_num_rows($Res);
		 
	return $total;	 
}

function Get_Total_Bid($item_id,$user_id,$bid_from)
{
	
    $Qry="select * from add_bids where item_id='$item_id' and bid_type='A' and bidbutler_type='B' and user_id='$user_id' and bid_rate>'$bid_from' and deleted='N'";
	$Res=$this->dbh->query($Qry);
	$total=@mysql_num_rows($Res);
		 
	return $total;	 
}

function Get_Status_Autobid($item_id)
{
	
   $Qry="select * from auto_bid where item_id='$item_id' and status='Y' and deleted='N'";
	$Res=$this->dbh->query($Qry);
	  $total=@mysql_num_rows($Res);
		 
	return $total;	 
}

function Get_Active_Autobid($item_id,$user_id)
{
	
    $Qry="select bid_from from auto_bid where item_id='$item_id' and user_id='$user_id' and status='Y' and deleted='N'";
	$Res=$this->dbh->query($Qry);
	$Data=@mysql_fetch_object($Res);
		 
	return $Data->bid_from;	 
}


function Get_Totalbids($item_id,$user_id)
{
	
    $Qry="select total_bid from auto_bid where item_id='$item_id' and user_id='$user_id' and status='Y' and deleted='N'";
	$Res=$this->dbh->query($Qry);
	$Data=@mysql_fetch_object($Res);
		 
	return $Data->total_bid;	 
}


function get_copy_pictures($sourcefile,$destinationfile)
{
			$handle = fopen($destinationfile,"w");
			// dynamic writing of index file for each system
			fwrite($handle,$sourcefile);  
			@chmod($path,0755);
			fclose($handle);
}
function get_amount_count($type1)
{
	$Qry="select * from amount_transfer where pay_type='Credit' and amount_type='$type1' and user_id='".$_SESSION['SESSIONUSERID']."' and deleted='N'";
	$Res=$this->dbh->query($Qry);
 return $Data=@mysql_num_rows($Res);

}
function get_count_bid($type1)
{
	$Qry="select * from amount_transfer where pay_type='Debit' and amount_type='$type1' and user_id='".$_SESSION['SESSIONUSERID']."' and deleted='N'";
	$Res=$this->dbh->query($Qry);
 return $Data=@mysql_num_rows($Res);

}

function get_amount($type1)
{
$Qry="select * from amount_transfer where  pay_type='Credit' and amount_type='$type1' and user_id='".$_SESSION['SESSIONUSERID']."' and deleted='N'";
	$Res=$this->dbh->query($Qry);
	$amount=0;
if(mysql_num_rows($Res)>0)
{
	
 	while($sql_row=mysql_fetch_object($Res))
 		$amount=$amount+$sql_row->amount;
	
}
return $amount;
}
function get_amount_bid($type1)
{
$Qry="select * from amount_transfer where  pay_type='Debit' and amount_type='$type1' and user_id='".$_SESSION['SESSIONUSERID']."' and deleted='N'";
	$Res=$this->dbh->query($Qry);
	$amount=0;
if(mysql_num_rows($Res)>0)
{
	
 	while($sql_row=mysql_fetch_object($Res))
 		$amount=$amount+$sql_row->amount;
	
}
return $amount;
}

function pemenang_total_bid($item_id,$user_id)
{
	$Qry="select * from add_bids where item_id='$item_id' and user_id='$user_id' and deleted='N'";
	$Res=$this->dbh->query($Qry);
	$total=@mysql_num_rows($Res);
		 
	return $total;	
}

function assist_stat($user_id)
{
	$Qry="select asisten from users where user_id='$user_id' and deleted='N'";
	$Res=$this->dbh->query($Qry);
	$Data=@mysql_fetch_object($Res);
	return $Data->asisten;
}

function my_total_bid($item_id)
{
	$Qry="select * from add_bids where item_id='$item_id' and user_id='".$_SESSION['SESSIONUSERID']."' and deleted='N'";
	$Res=$this->dbh->query($Qry);
	$total=@mysql_num_rows($Res);
		 
	return $total;	
}

function is_auction_assisted($item_id)
{
	$Qry="select asisten from bid where id='$item_id'";
	$Res=$this->dbh->query($Qry);
	$Data=@mysql_fetch_object($Res);
	return $Data->asisten;
}

function all_total_bid($item_id)
{
	$Qry="select * from add_bids where item_id='$item_id' and deleted='N'";
	$Res=$this->dbh->query($Qry);
	$total=@mysql_num_rows($Res);
		 
	return $total;	
}

function get_same_auction_time($title)
{
	global $lang;
	$Qry11="select end_time from bid where title like '%$title%' and end_bid='Y' and deleted='N' and auction_type!='P' order by id desc limit 1";
	$Res11=$this->dbh->query($Qry11);

	if(@mysql_num_rows($Res11)>0)
	{
		$sql_row=mysql_fetch_object($Res11);
		$pieces=explode(' ',$sql_row->end_time);
		$full_time=explode(":",$pieces[1]);
		$full_date=explode("-",$pieces[0]);
		$fdate=date("M-d-Y", mktime($full_time[0], $full_time[1], $full_time[2], $full_date[1], $full_date[0], $full_date[2]));
		
		$date_time=$fdate.' Jam '.$full_time[0].':'.$full_time[1];

	if($date_time!='')
		$last_auction_time=$lang[end_latest_on].'<br>'.$date_time;
	else
		$last_auction_time='';
	}	
	
	return $last_auction_time;
}

function get_same_auction_price($title)
{
	global $lang;
	$Qry11="select final_bid,target_price,auction_type,start_price,final_bid,start_price,delivery_cost,delivery_condition,fixed_price,id from bid where title like '%$title%' and end_bid='Y' and deleted='N' and auction_type!='P' order by id desc limit 1";
	$Res11=$this->dbh->query($Qry11);

	if(@mysql_num_rows($Res11)>0)
	{
		$sql_row=mysql_fetch_object($Res11);
		
		if($sql_row->auction_type=='E')
			$purchase_price=$sql_row->final_bid;
		else if($sql_row->auction_type=='N')
			$purchase_price=$sql_row->fixed_price;
		else if($sql_row->auction_type=='F')
			$purchase_price=0;	
		else if($sql_row->auction_type=='I')
			$purchase_price=$this->nailbiter_won_price($sql_row->id);
			
		if($sql_row->delivery_condition=='B')
			$total_purchase_price=$purchase_price+$sql_row->delivery_cost;
		else if($sql_row->delivery_condition=='S')	
			{
			if($sql_row->target_price<$sql_row->final_bid)
				$total_purchase_price=$purchase_price;
			else
				$total_purchase_price=$purchase_price+$sql_row->delivery_cost;
			}	

	if($total_purchase_price!='')
		$last_auction_price='Recently sold for '.$this->Get_Price_format($total_purchase_price);
	else
		$last_auction_price='';
	}
	
		return $last_auction_price;
}

function get_same_auction_title($title,$category_id,$item_id,$suggestion_auc)
{

	$Qry11="select id from bid where title like '%$title%' and id!='$item_id' and category='$category_id' and status='Y' and start='Y' and end_bid!='Y' and auction_type!='P' and running='Y'";
	
	if($suggestion_auc!='')
	$Qry11.=" and id not in ($suggestion_auc)";
	
	$Qry11.=" order by id desc limit 1";
	
	$Res11=$this->dbh->query($Qry11);

	if(@mysql_num_rows($Res11)>0)
	{
		$sql_row=mysql_fetch_object($Res11);
		$next_auction_title=$sql_row->id;
	}
	
	return $next_auction_title;
}

function Get_newimage($file_name,$width_to,$height_to)
	{
	global $SITE_URL;
	return "$SITE_URL/resizeimage.php?width_to=$width_to&height_to=$height_to&file_name=$file_name";
	}

function product_meta_tag($item_id)
{
	global $meta_keyword,$meta_description;
	$Res=$this->dbh->query("select meta_description,meta_keyword from bid where id='$item_id'");
	$Data=@mysql_fetch_object($Res);
	
	if($Data->meta_description!='' && $Data->meta_keyword!='')
	$meta_tag='<meta name="description" content="'.$Data->meta_description.'" >
				<meta name="keywords" content="'.$Data->meta_keyword.'" >';
	else
	$meta_tag='<meta name="description" content="'.$meta_description.'" >
				<meta name="keywords" content="'.$meta_keyword.'" >';
				
	return $meta_tag;

}

function nailbiter_won_price($item_id)
{
	$Qry="select bid_amt from add_bids where item_id='$item_id' and user_id='".$_SESSION['SESSIONUSERID']."' order by id desc";
	$Res=$this->dbh->query($Qry);
	$Data=@mysql_fetch_object($Res);
	
	return $Data->bid_amt;

}


function get_bid_field($item_id,$field_name)
{
	$Qry="select $field_name from bid where id='$item_id'";
	$Res=$this->dbh->query($Qry);
	$Data=@mysql_fetch_object($Res);
	
	return $Data->$field_name;
}


function get_addbid_field($item_id,$field_name)
{
	$Qry="select $field_name from add_bids where item_id='$item_id'";
	$Res=$this->dbh->query($Qry);
	$Data=@mysql_fetch_object($Res);
	
	return $Data->$field_name;
}

function watermark_field($field_name)
{
	$Qry="select $field_name from watermark_setting where id='1'";
	$Res=$this->dbh->query($Qry);
	$Data=@mysql_fetch_object($Res);
	
	return $Data->$field_name;
}

function get_water_image($source_path,$start_path,$new_name)
{
$watermark_image=$this->watermark_field('watermark');
$watermark_text=$this->watermark_field('watermark_text');
$watermark_color=$this->watermark_field('watermark_color');
$watermark_size=$this->watermark_field('watermark_size');
list($width, $height, $type, $attr) = getimagesize($source_path);
$last=substr(strrchr($source_path,"."),1);
//Thumbnail sample

$thumb=new Thumb($source_path);	        // Contructor and set source image file

//$thumb->memory_limit='32M';               //[OPTIONAL] set maximun memory usage, default 32 MB ('32M'). (use '16M' or '32M' for litter images)
//$thumb->max_execution_time='30';             //[OPTIONAL] set maximun execution time, default 30 seconds ('30'). (use '60' for big images o slow server)


//$thumb->quality=85;                         // [OPTIONAL] default 75 , only for JPG format
$thumb->output_format=$last;                // [OPTIONAL] JPG | PNG
/*$thumb->jpeg_progressive=0;               // [OPTIONAL] set progressive JPEG : 0 = no , 1 = yes
$thumb->allow_enlarge=false;              // [OPTIONAL] allow to enlarge the thumbnail
//$thumb->CalculateQFactor(10000);          // [OPTIONAL] Calculate JPEG quality factor for a specific size in bytes
//$thumb->bicubic_resample=false;             // [OPTIONAL] set resample algorithm to bicubic
*/

/*
$thumb->img_watermark=$watermark_image;	    // [OPTIONAL] set watermark source file, only PNG format [RECOMENDED ONLY WITH GD 2 ]


$thumb->img_watermark_Valing='TOP';   	    // [OPTIONAL] set watermark vertical position, TOP | CENTER | BOTTON
$thumb->img_watermark_Haling='LEFT';   	    // [OPTIONAL] set watermark horizonatal position, LEFT | CENTER | RIGHT
*/

$thumb->txt_watermark=$watermark_text;	    // [OPTIONAL] set watermark text [RECOMENDED ONLY WITH GD 2 ]
$thumb->txt_watermark_color=$watermark_color;	    // [OPTIONAL] set watermark text color , RGB Hexadecimal[RECOMENDED ONLY WITH GD 2 ]
$thumb->txt_watermark_font=$watermark_size;	            // [OPTIONAL] set watermark text font: 1,2,3,4,5
$thumb->txt_watermark_Valing='BOTTOM';   	// [OPTIONAL] set watermark text vertical position, TOP | CENTER | BOTTOM
$thumb->txt_watermark_Haling='RIGHT';       // [OPTIONAL] set watermark text horizonatal position, LEFT | CENTER | RIGHT
$thumb->txt_watermark_Hmargin=10;           // [OPTIONAL] set watermark text horizonatal margin in pixels
$thumb->txt_watermark_Vmargin=10;           // [OPTIONAL] set watermark text vertical margin in pixels

$thumb->size_width(150);				    // [OPTIONAL] set width for thumbnail, or
$thumb->size_height(113);				    // [OPTIONAL] set height for thumbnail, or
$thumb->size_auto(150);					    // [OPTIONAL] set the biggest width or height for thumbnail

$thumb->size($width,$height);		            // [OPTIONAL] set the biggest width and height for thumbnail

$thumb->process();   				        // generate image

//$thumb->show();						        // show your thumbnail, or

$thumb->save($start_path."watermark_".$new_name.".".$thumb->output_format);			// save your thumbnail to file, or
//$image = $thumb->dump();                  // get the image

//echo ($thumb->error_msg);  

}

	function get_currency($currency)
 	{
		if($currency=='Doller')
			return '$';
		else if($currency=='Rupiah')
			return 'Rp. ';
		else if($currency=='Pound')
			return '&pound;';
	}

function Get_Price_format($Price)
{
	global $Curr_sign; 
	$Price=number_format($Price, 0, ',', '.');

	if($Curr_sign=="$")
		$Price="$".$Price;
	else if($Curr_sign=="Rp. ")
		$Price="Rp ".$Price;	
	else if($Curr_sign=="&pound;")
		$Price="&pound;".$Price;
	else if($Curr_sign=='K&#232;')
		$Price=$Price."K&#232;";
	return $Price;	
}	

function get_auction_details($item_id)
{
$qry2="select * from bid_details where status='Y' and deleted='N' and item_id='$item_id' and lang='".$_SESSION['LANG']."'";
$qry1=$this->dbh->query($qry2);
$data = mysql_fetch_object($qry1);
$title=$data->title;
return $title;
}
	
function get_auction_all_auction($item_id)
{
$qry2="select * from bid_details where status='Y' and deleted='N' and item_id='$item_id'";
$qry1=$this->dbh->query($qry2);
$data = mysql_fetch_object($qry1);
$content=array();
$content[title]=$data->title;
$content[short_description]=$data->short_description;
$content[description]=$data->description;
$content[delivery_info]=$data->delivery_info;

return $content;

}


function scroll_extend_timer_auction()
{
global $Small_box,$show,$cat,$CURRENT_TIME;
$block_auction=$this->Get_unpaid_win_auction_title();
$category_auc=$this->category_auction();

$qry="select b.* from bid as b left join bid_details as d on b.id=d.item_id where b.deleted='N' and b.status='Y' and b.start='Y' and b.end_bid!='Y' and b.auction_type!='P' and b.running='Y' and d.lang='".$_SESSION['LANG']."'";

if($show=='index' || $show=='' || $show=='listing' || $show=='category_page' || $show=='product' || $show=='pause_auction')
{
if($block_auction!='' && $_SESSION['SESSIONUSERID']!='')
	$qry.=" and d.title not in ($block_auction)";
	if($cat!='')
	{
	$qry.=" and b.category='$cat'";
		if($category_auc!='')
			$qry.=" and b.id not in ($category_auc)";
	$qry.=" order by b.sequenceid,b.end_bid,b.extends_time,b.id desc limit $Small_box,4";
	}
	else
	$qry.=" order by b.sequenceid,b.end_bid,b.extends_time,b.id desc limit $Small_box,4";
}
else
$qry.=" order by RAND() limit 0,4";


$total_row=$this->dbh->query($qry);
$TOTAL_RECORDSET=mysql_num_rows($total_row);
$Timer_vales='';

	if($TOTAL_RECORDSET>0)
	{
	while($sqlRow=mysql_fetch_object($total_row))
		{
			
			$Timer_vales.=" Extend_timer[$sqlRow->id] =0; ";
				
		}
	}
	
	return $Timer_vales;

}


function product_suggestion_extend_timer_auction($category_id,$pro_id)
{
global $CURRENT_TIME;
$block_auction=$this->Get_unpaid_win_auction_title();
$qry="select b.* from bid as b left join bid_details as d on b.id=d.item_id where b.deleted='N' and b.id!='$pro_id' and b.status='Y' and b.start='Y' and b.end_bid!='Y' and b.auction_type!='P' and b.running='Y' and d.lang='".$_SESSION['LANG']."'";
	if($block_auction!='' && $_SESSION['SESSIONUSERID']!='')
	$qry.=" and d.title not in ($block_auction)";
	if($category_id!='')
		$qry.=" and b.category='$category_id'";
	/*if($title!='')
		$qry.=" and title like '%$title%'";*/

$qry.=" order by b.sequenceid,b.end_bid,b.extends_time,b.id desc limit 0,4";


$total_row=$this->dbh->query($qry);
$TOTAL_RECORDSET=mysql_num_rows($total_row);
$Timer_vales='';

	if($TOTAL_RECORDSET>0)
	{
	while($sqlRow=mysql_fetch_object($total_row))
		{
			
			$Timer_vales.=" Extend_timer[$sqlRow->id] =0; ";
		}
	}
	
	return $Timer_vales;

}

function balancecoin($balance)
{
// cari harga coin
$dbh = new GenericDatabaseClass();
$functions = new auction_functions($dbh);
$qry="select decrease_bid from general_setting";

$res=$dbh->query($qry);
$row=mysql_fetch_object($res);
$regocoin=stripslashes($row->decrease_bid);

if ($regocoin!=0) {
	$balancecoin=$balance / $regocoin;
	$balancecoin=(int)$balancecoin;
} else $balancecoin=0;	
return $balancecoin;
}

function product_scroll_extend_timer_auction($category_id,$pro_id)
{
global $CURRENT_TIME;
$block_auction=$this->Get_unpaid_win_auction_title();
$qry="select b.* from bid as b left join bid_details as d on b.id=d.item_id where b.deleted='N' and b.id!='$pro_id' and b.status='Y' and b.start='Y' and b.end_bid!='Y' and b.auction_type!='P' and b.running='Y' and d.lang='".$_SESSION['LANG']."'";

	if($block_auction!='' && $_SESSION['SESSIONUSERID']!='')
	$qry.=" and d.title not in ($block_auction)";
	if($category_id!='')
		$qry.=" and b.category!='$category_id'";
	/*if($title!='')
		$qry.=" and title like '%$title%'";*/

$qry.=" order by b.sequenceid,b.end_bid,b.extends_time,b.id desc limit 0,4";

$total_row=$this->dbh->query($qry);
$TOTAL_RECORDSET=mysql_num_rows($total_row);
$Timer_vales='';

	if($TOTAL_RECORDSET>0)
	{
	while($sqlRow=mysql_fetch_object($total_row))
		{
			
			$Timer_vales.=" Extend_timer[$sqlRow->id] =0; ";
		}
	}
	
	return $Timer_vales;

}
			


?>